Merge pull request #243 from nyaadevs/elasticsearch-fullword

Multi-field search display_name to match words over ngram limit. Resolves #205
This commit is contained in:
Johnny Ding
2017-06-05 20:34:04 -07:00
committed by GitHub
2 changed files with 20 additions and 1 deletions

View File

@@ -109,6 +109,8 @@ def search_elastic(term='', user=None, sort='id', order='desc',
# Apply search term
if term:
s = s.query('simple_query_string',
# Query both fields, latter for words with >15 chars
fields=['display_name', 'display_name.fullword'],
analyzer='my_search_analyzer',
default_operator="AND",
query=term)