mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
Source count index (#214)
* elasticsearch image index: add source_count * images query: add source_count field
This commit is contained in:
parent
f9a6240014
commit
ea25f2a01e
2 changed files with 3 additions and 1 deletions
|
@ -56,6 +56,7 @@ defmodule Philomena.Images.ElasticsearchIndex do
|
|||
size: %{type: "integer"},
|
||||
sha512_hash: %{type: "keyword"},
|
||||
source_url: %{type: "keyword"},
|
||||
source_count: %{type: "integer"},
|
||||
tag_count: %{type: "integer"},
|
||||
tag_ids: %{type: "keyword"},
|
||||
tags: %{type: "text", analyzer: "keyword"},
|
||||
|
@ -130,6 +131,7 @@ defmodule Philomena.Images.ElasticsearchIndex do
|
|||
uploader: if(!!image.user and !image.anonymous, do: String.downcase(image.user.name)),
|
||||
true_uploader: if(!!image.user, do: String.downcase(image.user.name)),
|
||||
source_url: image.sources |> Enum.map(&String.downcase(&1.source)),
|
||||
source_count: length(image.sources),
|
||||
file_name: image.image_name,
|
||||
original_format: image.image_format,
|
||||
processed: image.processed,
|
||||
|
|
|
@ -69,7 +69,7 @@ defmodule Philomena.Images.Query do
|
|||
defp anonymous_fields do
|
||||
[
|
||||
int_fields:
|
||||
~W(id width height comment_count score upvotes downvotes faves uploader_id faved_by_id tag_count pixels size),
|
||||
~W(id width height comment_count score upvotes downvotes faves uploader_id faved_by_id tag_count pixels size source_count),
|
||||
float_fields: ~W(aspect_ratio wilson_score duration),
|
||||
date_fields: ~W(created_at updated_at first_seen_at),
|
||||
literal_fields:
|
||||
|
|
Loading…
Reference in a new issue