UpStart Commerce Search
Spell Correction
Spell Check through Search Request
6min
spell check through search requests provides control and flexibility in testing your spell check configurations you can adjust your spell check configurations directly within your search requests, without the need to change your route, offering a seamless and customizable experience tailored to your specific needs this feature is particularly useful for testing different configurations before applying them globally how it works the enhanced spell check feature introduces four types of configurations auto this setting utilizes the spell check configuration defined at the route level it is the default when no spellcheck parameter is specified disabled if you prefer to disable spell check altogether, you can do so by setting spellcheck false limited with this option, you can limit the number of spell check results returned while still using the route's spell check configuration to implement limited spell check results, use the following parameters c "spellcheck" { "type" "limited", "limit" 3 } here, you can adjust the limited parameter to specify the desired maximum number of spell check results manual for complete customization, the manual setting allows you to override the spell check configuration defined at the route level and provide your configuration directly in the search request this option is particularly useful when you need specific spell check settings for individual queries to utilize manual spell check, use the following parameters "spellcheck" { "type" "manual", 	“limit” 3, "configuration" { "type" "mlbased", "highlight" { "pre tag" "\<b>", "post tag" "\</b>" } } } here, you can define your custom spell check configuration within the configuration object, including the type of spell check (type) and any additional highlighting preferences example usage let's walk through an example of how to create a route with the desired spell check configuration and then perform a search using the spell check parameters 1\ creating a route curl location 'https //nochannel dev 1 api nochannel dev upstart team/v1/search/routes' \\ \ header 'x upstart tenant denvermattress' \\ \ header 'content type application/json' \\ \ header 'x upstart api key your api key' \\ \ data '{ "id" "testing new flag", "displayname" "test route", "access" "public" "indexes" \[ { "id" "catalog live", "spellcheck" { "type" "mlbased" } } ] }' in this example, we've created a route named "test route" for the "catalog live" index with spell check configured to use a machine learning based model 2\ performing a search with new spell check parameters the site id must be provided to perform spellcheck hence, ensure that the site id is added properly, otherwise, spell check will fail curl location 'https //nochannel dev 1 api nochannel dev upstart team/v1/search/routes/testing new flag/search' \\ \ header 'x upstart tenant denvermattress' \\ \ header 'x upstart site your site id' \\ \ header 'content type application/json' \\ \ header 'x upstart api key your api key' \\ \ data '{ "search" { "query string" { "query" "pilow" } }, "mostvaluablequery" { "query" "pilow" } }' in this example, we're performing a search for the term "pilow" on the "test route" we created earlier the most valuable query contains the term/query that needs to be spellchecked, ensuring the focus is on the correct term for spell check processing