Spellchecking

Sooqr contains a spell checker that can suggest alternative queries when the main query returns no results. By default, the spellchecker is disabled in the Search API. You have to specify the spellcheck=1 option in the API URL to enable it.

Response example

Please note that the items tag is always empty when a spellcheck alternative is returned.

This is the result after searching on the query womin. The system returns two alternatives, women with 12 hits and woven with one hit. Suggestions are sorted on highest hitcount first.

{
   "items":[],
   "metaData":{
      "numFound":0,
      "maxScore":0,
      "queryTime":16,
      "start":0,
      "rows":10
   },
   "spellcheck":{
      "correctlySpelled":false,
      "suggestions":[
         {
            "query":"women",
            "hits":12
         },
         {
            "query":"woven",
            "hits":1
         }
      ]
   },
   "facets":false
}

Next steps

The next step is up to the API implementer. You can show the suggestions to your end-user and let them pick a new query. Or you can automatically retry a query with the top scoring suggestion, by replacing the query in your original API call.