UpStart Commerce Search
Spell Correction
Implementing Spell Correction
8min
step 1 through nochannel commerce portal pim or product catalog to enable spell correction on your products through our pim system, the following are the steps access the nochannel commerce portal and navigate the pim (product information management) section go to attributes and click the create attribute button to create a new attribute or click on an existing attribute to update when creating a new attribute, make sure the attribute type is set to “ string ”, otherwise, spell check configuration will not be available on any other type select the product scope level as either product , variant , or overrideable note note for details on attribute types and product scope level, go to pim attribute data types on the attribute detail page, locate the search configurations section at the bottom under default mappings , enable indexed and misspelling supported this activates the spell correction functionality for the specific attribute publish the attribute and navigate to the product templates on product template, click on the create template button to create a new template or edit an existing template select the spell check enabled attributes to add them to the product template once all the required attributes are added, publish the product template for more details on creating a product template, go to pim for more details on creating a product template, go to pim basic guide to product modeling note the misspelling supported mapping can only be enabled for the string type attributes to enable spell correction on your products through product catalog , the following are the steps access the nochannel commerce portal and navigate to the product catalog section select product types from the menu either click the + icon to create a product type or edit an existing one when creating a new product type, ensure the input type is " text field " under product properties , expand a property for which you want to enable spell correction under the attributes tab of the property, make sure to select the following fields property context must be product type must be textarea go to search configurations, and ensure the following options are enabled index property this ensures the field is included in the searchable data additionally, ensure that the product description property is at least enabled for misspelling misspelling supported this activates spell correction functionality for the specific attribute once enabled, click on save property repeat the above steps on all the properties that contain product content only to enable spell correction step 2 reindexing after enabling the spell correction feature for product types in the product catalog and attributes in the pim, administrators or users with specific user permissions can ensure the search data is up to date and accurate by reindexing the live catalog items the nochannel search api provides two endpoints for this purpose curl request post \\ url https //api upstartcommerce com/v1/catalog/live/search/reindex \\ header 'accept application/json' \\ header 'authorization bearer your access token' \\ header 'content type application/json' \\ header 'x upstart tenant your tenant id' this endpoint allows administrators to reindex the search data for live catalog items it is essential to ensure that any product types and attribute changes are accurately reflected in the search results the authorized permission catalog search reindex is required for this operation curl request post \\ url https //api upstartcommerce com/v1/catalog/wip/search/reindex \\ header 'accept application/json' \\ header 'authorization bearer your access token' \\ header 'content type application/json' \\ header 'x upstart tenant your tenant id' similarly, this endpoint allows administrators to reindex the search data for work in progress ( wip ) catalog items this ensures that any changes or updates made to the wip products are reflected accurately in the search results as with the previous endpoint, the catalog search reindex permission is required step 3 through the nochannel commerce apis step 1 creating a route with spell check ( optional) you may create a new route only if one does not exist that needs to have spell check enabled to create a route using the ml based spell check solution, use the following command, or simply add the spellcheck block to your existing route curl curl location 'https //nochannel dev 1 api nochannel dev upstart team/v1/search/routes' \\ \ header 'x upstart app your app id' \\ \ header 'x upstart site your site id' \\ \ header 'x upstart tenant your tenant id' \\ \ header 'content type application/json' \\ \ header 'x upstart api key your api key' \\ \ data '{ "id" "spellcheck route", "displayname" "spell check route", "access" "public", "indexes" \[ { "id" "catalog live", "spellcheck" { "type" "mlbased", "highlight" { "pre tag" "\<b>", "post tag" "\</b>" } } } ] }' this command creates a route named "spellcheck route" using the ml based spell check solution notes you can switch between opensearchbased and mlbased the index is used in route must have spell check enabled properties ( catalog live name is spell checkable by default) related index properties https //apidocs upstartcommerce com/docs/search/145594bdb48cc list index properties by index name existing routes https //apidocs upstartcommerce com/docs/search/a53181b425834 list routes update route by id https //apidocs upstartcommerce com/docs/search/e57dabc1b30db update route by id step 2 searching with spell check to search on the created route with corrections, use the following command curl location 'https //nochannel dev 1 api nochannel dev upstart team/v1/search/routes/spellcheck route/search' \\ \ header 'x upstart app your app id' \\ \ header 'x upstart site your site id' \\ \ header 'x upstart tenant your tenant id' \\ \ header 'content type application/json' \\ \ header 'x upstart api key your other api key' \\ \ data '{ search" { "query" { "query string" { "query" "matres" } } }, "tracking" "all" }' this command searches on the "spellcheck route" with the query "matres" and returns spell check suggestions with highlighted corrections using the ml based model usage guidelines business owners implementing the spell check api primarily improves search and quality of results, and enhances user satisfaction, leading to increased conversion rates and customer loyalty developers integrate the api seamlessly into your platform to ensure accurate search results, providing a smoother user experience go to the routes api document for more details