elasticsearch no longer uses doc_type, enable on padma and icma
This commit is contained in:
parent
b0ece6a566
commit
e7292a5989
3 changed files with 18 additions and 4 deletions
|
@ -312,6 +312,14 @@
|
||||||
"autocomplete": true,
|
"autocomplete": true,
|
||||||
"columnWidth": 128
|
"columnWidth": 128
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "fulltext",
|
||||||
|
"operator": "+",
|
||||||
|
"title": "Fulltext",
|
||||||
|
"type": "text",
|
||||||
|
"fulltext": true,
|
||||||
|
"find": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "created",
|
"id": "created",
|
||||||
"operator": "-",
|
"operator": "-",
|
||||||
|
|
|
@ -310,6 +310,14 @@
|
||||||
"autocomplete": true,
|
"autocomplete": true,
|
||||||
"columnWidth": 128
|
"columnWidth": 128
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "fulltext",
|
||||||
|
"operator": "+",
|
||||||
|
"title": "Fulltext",
|
||||||
|
"type": "text",
|
||||||
|
"fulltext": true,
|
||||||
|
"find": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "created",
|
"id": "created",
|
||||||
"operator": "-",
|
"operator": "-",
|
||||||
|
|
|
@ -42,7 +42,6 @@ def ocr_image(path):
|
||||||
|
|
||||||
class FulltextMixin:
|
class FulltextMixin:
|
||||||
_ES_INDEX = "document-index"
|
_ES_INDEX = "document-index"
|
||||||
_ES_DOC_TYPE = "document"
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def elasticsearch(cls):
|
def elasticsearch(cls):
|
||||||
|
@ -67,7 +66,7 @@ class FulltextMixin:
|
||||||
if self.has_fulltext_key():
|
if self.has_fulltext_key():
|
||||||
from elasticsearch.exceptions import NotFoundError
|
from elasticsearch.exceptions import NotFoundError
|
||||||
try:
|
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:
|
except NotFoundError:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
|
@ -80,7 +79,7 @@ class FulltextMixin:
|
||||||
doc = {
|
doc = {
|
||||||
'text': text.lower()
|
'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
|
@classmethod
|
||||||
def find_fulltext(cls, query):
|
def find_fulltext(cls, query):
|
||||||
|
@ -176,7 +175,6 @@ class FulltextMixin:
|
||||||
|
|
||||||
class FulltextPageMixin(FulltextMixin):
|
class FulltextPageMixin(FulltextMixin):
|
||||||
_ES_INDEX = "document-page-index"
|
_ES_INDEX = "document-page-index"
|
||||||
_DOC_TYPE = 'page'
|
|
||||||
|
|
||||||
def extract_fulltext(self):
|
def extract_fulltext(self):
|
||||||
if self.document.file:
|
if self.document.file:
|
||||||
|
|
Loading…
Reference in a new issue