server/search: automatically add wildcards for source URL searching

This commit is contained in:
Shyam Sunder 2019-04-07 12:46:21 -04:00 committed by Marcin Kurczewski
parent 1d8cfd5a89
commit d69ef710b3

View file

@ -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)
),
(