Spellchecking#
Profiles: Project Creator, Search User
This feature enables the user to spellcheck a potential query based on the data which is loaded in Squirro.
To achieve this, Squirro makes use of the Elasticsearch suggester functionality.
Search users are presented with spelling suggestions if an incorrectly-spelled query is identified by Squirro.
Project creators can configure spellchecking settings and determine how the feature is presented to search users.
Spellchecking in Cognitive Search#
Spellchecking is a feature shipped out of the box in Squirro Cognitive Search that presents itself via the Spelling Correction Widget.
By default, when a search user enters a query the widget believes is misspelled, it will present the user with a suggestion, as shown in the example screenshot below:
The search user can then click on the suggestion to re-search with the corrected query.
In the example above, Squirro correctly identified that the search user was looking for information about arsenic, but had misspelled the word.
How to Set Up Spellchecking#
If you are working with a project where spellchecking is not enabled by default, or you would like to add it to a custom dashboard, follow the steps below:
Navigate to your project’s Setup space.
Click the Visualization tab.
Hover over the dashboard you’d like to edit, click the three dots to bring up the drop-down menu, and click Edit.
Select a layer to add the widget to, or create a new layer.
Add the Spelling Correction widget, as shown in the screenshot below:
Configure the visibility conditions of the layer the widget sits within, if desired.
Reference: Learn more about Visibility Conditions within the Dashboard Editor.
Tip
Typically, you’ll want to set a visibility condition for the spellcheck widget to hide it when it’s not in use.
How It Works#
You can send a normal query/item request to the topic api (/v0/{tenant}/projects/{project_id}/items/query
) in addition to the query you add a tag spellcheck in the following format:
'spellcheck': {'text': 'squiro','field': 'body.en.unstemmed'}
The field text
holds the query on which you would like to have a suggestion and the field field
takes the Elasticsearch index in which the spellchecker respectively Elasticsearch needs to look for similar words.
The topic api then picks the suggested word with the highest score from the Elasticsearch response. As a response you get in addition to the query results a dictionary with suggestions to your spellcheck query:
'spellcheck': {'original': 'squiro', 'corrected': 'squirro'}