From 55a73995c82eb8b1e8239b197f8671296065fd84 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 21 Jul 2022 15:39:27 +0700 Subject: [PATCH] implement source and lang keywords for full text search --- tubearchivist/home/src/frontend/searching.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tubearchivist/home/src/frontend/searching.py b/tubearchivist/home/src/frontend/searching.py index 9840cc3..b14cc65 100644 --- a/tubearchivist/home/src/frontend/searching.py +++ b/tubearchivist/home/src/frontend/searching.py @@ -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"},