Implementing Spell Correction
Step 1: Through NoChannel Commerce Portal PIM or Product Catalog
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
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.