From a3428945f40fb081718c8aec3ab87febf474933e Mon Sep 17 00:00:00 2001 From: mdashlw Date: Thu, 14 Mar 2024 16:44:15 +0300 Subject: [PATCH] Search images by file name (#206) * feat(Images.Query): add literal file_name field * feat(templates/search): add file_name to search dropdown --- lib/philomena/images/query.ex | 2 +- lib/philomena_web/templates/search/_form.html.slime | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/philomena/images/query.ex b/lib/philomena/images/query.ex index 12a33423..d9f6346e 100644 --- a/lib/philomena/images/query.ex +++ b/lib/philomena/images/query.ex @@ -73,7 +73,7 @@ defmodule Philomena.Images.Query do float_fields: ~W(aspect_ratio wilson_score duration), date_fields: ~W(created_at updated_at first_seen_at), literal_fields: - ~W(faved_by orig_sha512_hash sha512_hash uploader source_url original_format mime_type), + ~W(faved_by orig_sha512_hash sha512_hash uploader source_url original_format mime_type file_name), bool_fields: ~W(animated processed thumbnails_generated), ngram_fields: ~W(description), custom_fields: ~W(gallery_id), diff --git a/lib/philomena_web/templates/search/_form.html.slime b/lib/philomena_web/templates/search/_form.html.slime index 685528b9..d5b52422 100644 --- a/lib/philomena_web/templates/search/_form.html.slime +++ b/lib/philomena_web/templates/search/_form.html.slime @@ -21,6 +21,7 @@ h1 Search a data-search-add="comment_count.gt:20" data-search-select-last="2" data-search-show-help="numeric" Number of comments a data-search-add="uploader:k_a" data-search-select-last="3" data-search-show-help="literal" Uploader a data-search-add="original_format:gif" data-search-select-last="3" data-search-show-help="literal" File extension + a data-search-add="file_name:tumblr_*" data-search-select-last="8" data-search-show-help="literal" Original file name a data-search-add="mime_type:image/jpeg" data-search-select-last="10" data-search-show-help="literal" MIME type a data-search-add="source_url:*deviantart.com*" data-search-select-last="16" data-search-show-help="literal" Image source URL a data-search-add="width:1920" data-search-select-last="4" data-search-show-help="numeric" Image width