From 0172a152d33d6a9e9577b2812b568c9fb8e4517c Mon Sep 17 00:00:00 2001 From: j Date: Sun, 1 Dec 2019 15:25:45 +0100 Subject: [PATCH] dont use 'fulltext' type, add fulltext flag --- pandora/document/managers.py | 7 ++++++- pandora/document/models.py | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pandora/document/managers.py b/pandora/document/managers.py index b55afeea..7f045390 100644 --- a/pandora/document/managers.py +++ b/pandora/document/managers.py @@ -36,6 +36,8 @@ def get_key_type(k): }.get(key_type, key_type) return key_type + + def parseCondition(condition, user, item=None, owner=None): ''' ''' @@ -68,6 +70,9 @@ def buildCondition(k, op, v, user, exclude=False, owner=None): k = 'collection' key_type = get_key_type(k) + + key_config = (utils.get_by_id(settings.CONFIG['documentKeys'], k) or {'type': 'string'}).get('type') + facet_keys = models.Document.facet_keys if k == 'id': if op == '&' and isinstance(v, list): @@ -128,7 +133,7 @@ def buildCondition(k, op, v, user, exclude=False, owner=None): else: q = Q(id=0) return q - elif key_type == 'fulltext': + elif key_config.fulltext: qs = models.Document.find_fulltext_ids(v) q = Q(id__in=qs) if exclude: diff --git a/pandora/document/models.py b/pandora/document/models.py index a436360a..0c61f019 100644 --- a/pandora/document/models.py +++ b/pandora/document/models.py @@ -154,7 +154,9 @@ class Document(models.Model, FulltextMixin): i = key['id'] if i == 'rightslevel': save(i, self.rightslevel) - elif i not in ('*', 'dimensions', 'fulltext') and i not in self.facet_keys: + if key.get('fulltext'): + continue + elif i not in ('*', 'dimensions') and i not in self.facet_keys: value = data.get(i) if isinstance(value, list): value = u'\n'.join(value)