From d69ef710b3e56d58b4dd40bb4ae1e19e5af0912f Mon Sep 17 00:00:00 2001 From: Shyam Sunder Date: Sun, 7 Apr 2019 12:46:21 -0400 Subject: [PATCH] server/search: automatically add wildcards for source URL searching --- server/szurubooru/search/configs/post_search_config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/szurubooru/search/configs/post_search_config.py b/server/szurubooru/search/configs/post_search_config.py index a1628ecb..ec9bcae0 100644 --- a/server/szurubooru/search/configs/post_search_config.py +++ b/server/szurubooru/search/configs/post_search_config.py @@ -43,6 +43,10 @@ def _flag_transformer(value: str) -> str: return '%' + search_util.enum_transformer(available_values, value) + '%' +def _source_transformer(value: str) -> str: + return search_util.wildcard_transformer('*' + value + '*') + + def _create_score_filter(score: int) -> Filter: def wrapper( query: SaQuery, @@ -232,7 +236,8 @@ class PostSearchConfig(BaseSearchConfig): ( ['source'], - search_util.create_str_filter(model.Post.source) + search_util.create_str_filter( + model.Post.source, _source_transformer) ), (