From e7292a59897a1114a1560f507852eb9c7e02d89c Mon Sep 17 00:00:00 2001 From: j Date: Wed, 12 Jul 2023 14:59:55 +0530 Subject: [PATCH] elasticsearch no longer uses doc_type, enable on padma and icma --- pandora/config.indiancinema.jsonc | 8 ++++++++ pandora/config.padma.jsonc | 8 ++++++++ pandora/document/fulltext.py | 6 ++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pandora/config.indiancinema.jsonc b/pandora/config.indiancinema.jsonc index b5f488e2..114dcfb2 100644 --- a/pandora/config.indiancinema.jsonc +++ b/pandora/config.indiancinema.jsonc @@ -312,6 +312,14 @@ "autocomplete": true, "columnWidth": 128 }, + { + "id": "fulltext", + "operator": "+", + "title": "Fulltext", + "type": "text", + "fulltext": true, + "find": true + }, { "id": "created", "operator": "-", diff --git a/pandora/config.padma.jsonc b/pandora/config.padma.jsonc index 07625f48..6c425f6f 100644 --- a/pandora/config.padma.jsonc +++ b/pandora/config.padma.jsonc @@ -310,6 +310,14 @@ "autocomplete": true, "columnWidth": 128 }, + { + "id": "fulltext", + "operator": "+", + "title": "Fulltext", + "type": "text", + "fulltext": true, + "find": true + }, { "id": "created", "operator": "-", diff --git a/pandora/document/fulltext.py b/pandora/document/fulltext.py index 899f9eb5..7e246b97 100644 --- a/pandora/document/fulltext.py +++ b/pandora/document/fulltext.py @@ -42,7 +42,6 @@ def ocr_image(path): class FulltextMixin: _ES_INDEX = "document-index" - _ES_DOC_TYPE = "document" @classmethod def elasticsearch(cls): @@ -67,7 +66,7 @@ class FulltextMixin: if self.has_fulltext_key(): from elasticsearch.exceptions import NotFoundError try: - res = self.elasticsearch().delete(index=self._ES_INDEX, doc_type=self._ES_DOC_TYPE, id=self.id) + res = self.elasticsearch().delete(index=self._ES_INDEX, id=self.id) except NotFoundError: pass except: @@ -80,7 +79,7 @@ class FulltextMixin: doc = { 'text': text.lower() } - res = self.elasticsearch().index(index=self._ES_INDEX, doc_type=self._ES_DOC_TYPE, id=self.id, body=doc) + res = self.elasticsearch().index(index=self._ES_INDEX, id=self.id, body=doc) @classmethod def find_fulltext(cls, query): @@ -176,7 +175,6 @@ class FulltextMixin: class FulltextPageMixin(FulltextMixin): _ES_INDEX = "document-page-index" - _DOC_TYPE = 'page' def extract_fulltext(self): if self.document.file: