UpStart Commerce Search
Spell Correction
Using Alternative Indexes for Spell Correction
4min
you can create routes that use a different index to perform spell check while still retrieving search results from the primary search index how it works by specifying an alternative index for spell checking, you can optimize your search functionality without compromising the quality of your search results the spell check operation will be performed on the specified alternative index, while the actual search results will still come from the primary search index implementing alternative index spell check to create a route with an alternative index for spell check, follow these steps step 1 create a route with alternative index spell check use the following api call to create a new route with the alternative index spell check feature curl location 'https //nochannel dev 1 api nochannel dev upstart team/v1/search/routes' \\ \ header 'x upstart tenant your tenant id' \\ \ header 'x upstart app your app id' \\ \ header 'content type application/json' \\ \ header 'x upstart api key your api key' \\ \ data '{ "id" "route name", "displayname" "alternative index spell check route", "access" "public", "indexes" \[ { "id" "index to perform search", "spellcheck" { "type" "mlbased", "alternativeindexname" "alternative index to perform spellcheck" } } ] }' this command creates a new route with the following key components id a unique identifier for your route (e g , "route name") displayname a human readable name for your route (e g , "alternative index spell check route") access set to "public" to allow general access indexes specifies the primary search index and spell check configuration id the primary index used for search results spellcheck configuration for spell checking type set to "mlbased" for machine learning based spell checking alternativeindexname the name of the alternative index to use for spell checking step 2 using the new route once you've created the route with the alternative index spell check, you can use it in your search requests just like any other route the spell check will be performed on the specified alternative index, while search results will still come from the primary index benefits of using alternative indexes performance optimization by using a smaller, more focused index for spell checking, you can potentially improve the speed of spell check operations customized spell checking you can create a specialized index containing only the most relevant terms for spell checking, potentially improving accuracy for your specific use case flexibility this feature allows you to separate your spell check data from your main search data, giving you more control over how spell checking is performed by leveraging alternative indexes for spell check, you can fine tune your search experience, potentially improving both performance and accuracy for your users