-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggestion endpoint; from elasticsearch
- Loading branch information
1 parent
742b900
commit 6322e0a
Showing
3 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
index_settings='{ "settings": { "index": { "analysis": { "filter": { "stemmer": { "type": "stemmer", "language": "english" }, "autocompleteFilter": { "max_shingle_size": "5", "min_shingle_size": "2", "type": "shingle" }, "stopwords": { "type": "stop", "stopwords": [ "_english_" ] } }, "analyzer": { "didYouMean": { "filter": [ "lowercase" ], "char_filter": [ "html_strip" ], "type": "custom", "tokenizer": "standard" }, "autocomplete": { "filter": [ "lowercase", "autocompleteFilter" ], "char_filter": [ "html_strip" ], "type": "custom", "tokenizer": "standard" }, "default": { "filter": [ "lowercase", "stopwords", "stemmer" ], "char_filter": [ "html_strip" ], "type": "custom", "tokenizer": "standard" } } } } } }' | ||
mapping='{ "player_stats": { "properties": { "autocomplete": { "type": "string", "analyzer": "autocomplete" }, "did_you_mean": { "type": "string", "analyzer": "didYouMean" }, "question": { "type": "string", "copy_to": [ "autocomplete", "did_you_mean" ] } } } }' | ||
mapping='{ "player_stats": { "properties": { "autocomplete": { "type": "string", "analyzer": "autocomplete" }, "did_you_mean": { "type": "string", "analyzer": "didYouMean" }, "question": { "type": "string", "copy_to": [ "autocomplete", "did_you_mean" ] } } } }' | ||
|
||
def es_suggestion(search_string): | ||
return '{"suggest":{"didYouMean":{"text":"%s","phrase":{"field":"did_you_mean"}}},"query":{"match":{"question":"%s"}}}' % (search_string, search_string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters