BO news via ES #4
This commit is contained in:
parent
65a6ac0dd0
commit
aab99af87f
|
|
@ -186,7 +186,8 @@ class NewsQuerySet(TranslationQuerysetMixin):
|
|||
_query |= elasticsearch_dsl.Q('wildcard', **{key: {'value': f'*{search_value}*', 'boost': boost + 30}})
|
||||
search = NewsDocument.search().query('bool', should=_query)[0:10000].execute()
|
||||
ids = [result.meta.id for result in search]
|
||||
return self.filter(id__in=ids)
|
||||
preserved = Case(*[When(pk=pk, then=pos) for pos, pk in enumerate(ids)])
|
||||
return self.filter(id__in=ids).order_by(preserved)
|
||||
|
||||
def trigram_search(self, search_value: str):
|
||||
"""Search with mistakes by description or title or subtitle."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user