Update Suggestions ("Did you mean" feature!) authored by Fruth, Leon's avatar Fruth, Leon
......@@ -5,6 +5,8 @@
- Phrase suggester: Suggests corrections for phrases.
## Phrase suggester
Works overall better than Term suggester: "In practice this suggester will be able to make better decisions about which tokens to pick based on co-occurrence and frequencies."
1. Works with phrases:
Query:
......@@ -77,7 +79,10 @@ Results:
### How does it work
### Settings and Arguments
### Settings and Parameters
[Parameters Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#_basic_phrase_suggest_api_parameters)
- *max_errors*: sets how many terms in a phrase are corrected. Default value set to 1. In these tests I set the value to 2!
- *analyzer*: TODO: How does this work?
## Building a "Did you mean"-Feature
......@@ -94,16 +99,17 @@ Results:
2. Aggregated results: [{'text': 'python', 'score': 0.061882425}, {'text': 'pyhton', 'score': 0.020105202}]
3. **Did you mean: "python"**
#### Search string: **"data midning"**
#### Search string: **"dats midning"**
1. Suggestions
- Title Field: [{'text': 'data mining', 'score': 0.012581152}]
- Body Field: [{'text': 'data mining', 'score': 0.002154175}, {'text': 'data missing', 'score': 0.0012882735}, {'text': 'data manning', 'score': 0.0010319541}, {'text': 'data meaning', 'score': 0.0010319541}]
2. Aggregated results: [{'text': 'data mining', 'score': 0.014735327}, {'text': 'data missing', 'score': 0.0012882735}, {'text': 'data manning', 'score': 0.0010319541}, {'text': 'data meaning', 'score': 0.0010319541}]
- Title Field: [{'text': 'data mining', 'score': 0.01135363}, {'text': 'does mining', 'score': 0.011018485}]
- Body Field: [{'text': 'data mining', 'score': 0.0019439956}, {'text': 'data missing', 'score': 0.0011625788}, {'text': 'das minding', 'score': 0.0011426819}, {'text': 'das mining', 'score': 0.00094476255}, {'text': 'data manning', 'score': 0.00093126803}]
2. Aggregated results: [{'text': 'data mining', 'score': 0.0132976256}, {'text': 'does mining', 'score': 0.011018485}, {'text': 'data missing', 'score': 0.0011625788}, {'text': 'das minding', 'score': 0.0011426819}, {'text': 'das mining', 'score': 0.00094476255}, {'text': 'data manning', 'score': 0.00093126803}]
3. **Did you mean: "data mining"**
#### Search string: **"data midning"**
1. Suggestions
- Title Field: [{'text': 'data mining', 'score': 0.012581152}]
- Body Field: [{'text': 'data mining', 'score': 0.002154175}, {'text': 'data missing', 'score': 0.0012882735}, {'text': 'data manning', 'score': 0.0010319541}, {'text': 'data meaning', 'score': 0.0010319541}]
2. Aggregated results: [{'text': 'data mining', 'score': 0.014735327}, {'text': 'data missing', 'score': 0.0012882735}, {'text': 'data manning', 'score': 0.0010319541}, {'text': 'data meaning', 'score': 0.0010319541}]
#### Search string: **"pthun progrmaing tutorial"**
1. Suggestions
- Title Field: []
- Body Field: [{'text': 'python programming tutorial', 'score': 0.00014904435}, {'text': 'python progrmaing tutorial', 'score': 2.8872057e-05}, {'text': 'pthun programming tutorial', 'score': 2.1344658e-05}]
2. Aggregated results: [{'text': 'python programming tutorial', 'score': 0.00014904435}, {'text': 'python progrmaing tutorial', 'score': 2.8872057e-05}, {'text': 'pthun programming tutorial', 'score': 2.1344658e-05}]
3. **Did you mean: "python programming tutorial"**