- Search suggestions queries don’t do infix matching, only prefix matching. This was by far the most common post of feedback.
- Suggestions were limited to 10 per result, too few for some scenarios.
- Suggestions were limited to 25 characters in length. In some cases people would like to go further than that.
- Suggestions required at least 3 characters in the input to return results.
Infix Matching and Fuzzy Matching
We have deployed to production an entirely new implementation of suggestions that addresses all these items. In particular it’ll do infix matching for suggestions, allowing the user to enter ‘brown fo’, and retrieve suggestions such as ‘The quick brown fox jumped…’ (matches still need to be at word boundaries, it won’t match character sequences that exist mid-term). Fuzzy matching is enabled to allow for more flexibility for spelling mistakes. It also allows up to 100 suggestions per result, has no limit in length other than field limits and doesn’t have the 3-character minimum length. It’s still under the experimental version 2014-10-20-Preview since we’re not done getting feedback and adjusting the feature. Our previous API for suggestions was a boolean “suggestions” option in the field definition. While it was simple, it had no room to grow (e.g. there was not spot to indicate which matching strategy to use). We are augmenting the API for suggestions now so in the future we have space to add more capabilities. Indexes now have a collection of “suggesters” which have a name and a search mode (which will allow us to bring prefix-matching suggesters to the new API soon). The first suggester we’re introducing sources suggestions from fields in documents and uses infix matching. This is what a new index definition looks like including a suggester:{ fields: [ { "name": "id", "type": "Edm.String", "key": true }, { "name": "title", "type": "Edm.String" } ], suggesters: [ { "name": "sg", "searchMode": "analyzingInfixMatching", "sourceFields": ["title"] } ] }To use it in suggestions requests you need to reference the suggester (always remember to URL-encode the search text):
https://mysvcname.search.windows.net/indexes/myindex/docs/suggest?api-version=2014-10-20-Preview&search=lazy+dog&suggesterName=sg