server/search: automatically add wildcards for source URL searching
This commit is contained in:
parent
1d8cfd5a89
commit
d69ef710b3
1 changed files with 6 additions and 1 deletions
|
@ -43,6 +43,10 @@ def _flag_transformer(value: str) -> str:
|
||||||
return '%' + search_util.enum_transformer(available_values, value) + '%'
|
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 _create_score_filter(score: int) -> Filter:
|
||||||
def wrapper(
|
def wrapper(
|
||||||
query: SaQuery,
|
query: SaQuery,
|
||||||
|
@ -232,7 +236,8 @@ class PostSearchConfig(BaseSearchConfig):
|
||||||
|
|
||||||
(
|
(
|
||||||
['source'],
|
['source'],
|
||||||
search_util.create_str_filter(model.Post.source)
|
search_util.create_str_filter(
|
||||||
|
model.Post.source, _source_transformer)
|
||||||
),
|
),
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in a new issue