Compare commits
2 commits
823b8f2136
...
14e197819d
| Author | SHA1 | Date | |
|---|---|---|---|
| 14e197819d | |||
| 2889c15dc8 |
3 changed files with 7 additions and 5 deletions
|
|
@ -36,12 +36,13 @@ class FulltextMixin:
|
||||||
return self.data.get('text', '')
|
return self.data.get('text', '')
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def delete_fulltext(self):
|
|
||||||
res = self.elasticsearch().delete(index=self._ES_INDEX, doc_type='document', id=self.id)
|
|
||||||
|
|
||||||
def has_fulltext_key():
|
def has_fulltext_key():
|
||||||
return bool([k for k in settings.CONFIG['documentKeys'] if k.get('fulltext')])
|
return bool([k for k in settings.CONFIG['documentKeys'] if k.get('fulltext')])
|
||||||
|
|
||||||
|
def delete_fulltext(self):
|
||||||
|
if self.has_fulltext_key():
|
||||||
|
res = self.elasticsearch().delete(index=self._ES_INDEX, doc_type='document', id=self.id)
|
||||||
|
|
||||||
def update_fulltext(self):
|
def update_fulltext(self):
|
||||||
if self.has_fulltext_key():
|
if self.has_fulltext_key():
|
||||||
text = self.extract_fulltext()
|
text = self.extract_fulltext()
|
||||||
|
|
|
||||||
|
|
@ -653,6 +653,7 @@ def delete_document(sender, **kwargs):
|
||||||
if t.file:
|
if t.file:
|
||||||
t.delete_cache()
|
t.delete_cache()
|
||||||
t.file.delete(save=False)
|
t.file.delete(save=False)
|
||||||
|
t.delete_fulltext()
|
||||||
pre_delete.connect(delete_document, sender=Document)
|
pre_delete.connect(delete_document, sender=Document)
|
||||||
|
|
||||||
class ItemProperties(models.Model):
|
class ItemProperties(models.Model):
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ pandora.ui.findDocumentsElement = function() {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
] : [], [
|
] : [], [
|
||||||
$findSelect = Ox.Select({
|
pandora.$ui.findDocumentsSelect = $findSelect = Ox.Select({
|
||||||
id: 'select',
|
id: 'select',
|
||||||
items: [].concat(
|
items: [].concat(
|
||||||
pandora.site.documentKeys.filter(function(key) {
|
pandora.site.documentKeys.filter(function(key) {
|
||||||
|
|
@ -70,7 +70,7 @@ pandora.ui.findDocumentsElement = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
$findInput = Ox.Input({
|
pandora.$ui.findDocumentsInput = $findInput = Ox.Input({
|
||||||
autocomplete: autocompleteFunction(),
|
autocomplete: autocompleteFunction(),
|
||||||
autocompleteSelect: true,
|
autocompleteSelect: true,
|
||||||
autocompleteSelectHighlight: true,
|
autocompleteSelectHighlight: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue