implement source and lang keywords for full text search

This commit is contained in:
simon 2022-07-21 15:39:27 +07:00
parent a40ebc7bbc
commit 55a73995c8
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 10 additions and 0 deletions

View File

@ -252,6 +252,8 @@ class SearchParser:
"full": {
"index": "ta_subtitle",
"term": [],
"lang": [],
"source": [],
},
}
@ -481,6 +483,14 @@ class QueryBuilder:
}
)
if (lang := self.query_map.get("lang")) is not None:
must_list.append({"term": {"subtitle_lang": {"value": lang[0]}}})
if (source := self.query_map.get("source")) is not None:
must_list.append(
{"term": {"subtitle_source": {"value": source[0]}}}
)
query = {
"size": 30,
"_source": {"excludes": "subtitle_line"},