*D (only deleted, no merges) search opt

This commit is contained in:
Luna D 2019-12-19 17:39:34 -05:00
parent ae476b45d8
commit 45e3d2801d
No known key found for this signature in database
GPG key ID: D0F46C94720BAA4B
5 changed files with 13 additions and 2 deletions

View file

@ -24,6 +24,7 @@ defmodule Philomena.Images.Elasticsearch do
downvoter_ids: %{type: "keyword"},
downvoters: %{type: "keyword"},
downvotes: %{type: "integer"},
duplicate_id: %{type: "integer"},
faves: %{type: "integer"},
favourited_by_user_ids: %{type: "keyword"},
favourited_by_users: %{type: "keyword"},
@ -118,6 +119,7 @@ defmodule Philomena.Images.Elasticsearch do
upvoter_ids: image.upvoters |> Enum.map(& &1.id),
downvoter_ids: image.downvoters |> Enum.map(& &1.id),
deleted_by_user_id: image.deleter_id,
duplicate_id: image.duplicate_id,
galleries:
image.gallery_interactions |> Enum.map(&%{id: &1.gallery_id, position: &1.position}),
namespaced_tags: %{

View file

@ -73,6 +73,9 @@ defmodule PhilomenaWeb.ImageLoader do
defp maybe_show_deleted(filters, true, "only"),
do: [%{term: %{hidden_from_users: false}} | filters]
defp maybe_show_deleted(filters, true, "deleted"),
do: [%{term: %{hidden_from_users: false}}, %{exists: %{field: :duplicate_id}} | filters]
defp maybe_show_deleted(filters, true, _param),
do: [%{term: %{hidden_from_users: true}} | filters]

View file

@ -23,3 +23,9 @@
i.fa.fa-minus
i.fa.fa-exclamation>
span.hide-mobile.hide-limited-desktop Hide Deleted
= if del != "deleted" do
a href=@route.(Keyword.put(@params, :del, "deleted")) title="Only Deleted (Strict)"
i.fa.fa-minus
i.fa.fa-object-group>
span.hide-mobile.hide-limited-desktop Exclude Merges

View file

@ -20,7 +20,7 @@ header.header
input type="hidden" name="sd" value=@conn.params["sd"]
= if hides_images?(@conn) do
= select f, :del, [{"-D", ""}, {"+D", 1}, {"DO", "only"}], name: "del", class: "input header__input", autocomplete: "off"
= select f, :del, [{"-D", ""}, {"+D", 1}, {"*D", "deleted"}, {"DO", "only"}], name: "del", class: "input header__input", autocomplete: "off"
button.header__search__button type="submit" title="Search"
i.fa-embedded--search