dont use 'fulltext' type, add fulltext flag

This commit is contained in:
j 2019-12-01 15:25:45 +01:00
parent 2f7e8a0780
commit 0172a152d3
2 changed files with 9 additions and 2 deletions

View file

@ -36,6 +36,8 @@ def get_key_type(k):
}.get(key_type, key_type) }.get(key_type, key_type)
return key_type return key_type
def parseCondition(condition, user, item=None, owner=None): def parseCondition(condition, user, item=None, owner=None):
''' '''
''' '''
@ -68,6 +70,9 @@ def buildCondition(k, op, v, user, exclude=False, owner=None):
k = 'collection' k = 'collection'
key_type = get_key_type(k) 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 facet_keys = models.Document.facet_keys
if k == 'id': if k == 'id':
if op == '&' and isinstance(v, list): if op == '&' and isinstance(v, list):
@ -128,7 +133,7 @@ def buildCondition(k, op, v, user, exclude=False, owner=None):
else: else:
q = Q(id=0) q = Q(id=0)
return q return q
elif key_type == 'fulltext': elif key_config.fulltext:
qs = models.Document.find_fulltext_ids(v) qs = models.Document.find_fulltext_ids(v)
q = Q(id__in=qs) q = Q(id__in=qs)
if exclude: if exclude:

View file

@ -154,7 +154,9 @@ class Document(models.Model, FulltextMixin):
i = key['id'] i = key['id']
if i == 'rightslevel': if i == 'rightslevel':
save(i, self.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) value = data.get(i)
if isinstance(value, list): if isinstance(value, list):
value = u'\n'.join(value) value = u'\n'.join(value)