Plural and singular searches
Plural and singular searches
In the context of commerce search, you may notice discrepancies in the search results returned for a specific term when queried in its singular versus plural form.
As a user of a Coveo-powered ecommerce website, you want to shop for various types of plants.
When you enter plant
in the search box, you noticed that the returned results are products containing the plant
keyword in their title.
These products are mostly plant accessories, such as pots and stands.
You then search once more by entering plants
in your query, which now returns actual plants.
The discrepancies between the returned results are often caused because the query searches the index for exact matches in the terms contained in both the product’s body and category field.
In the previous example, the first query searched the index for items containing the plant
term, which are mostly plant accessories.
It also searched for the plant
category, which doesn’t exist in your index.
Plants and plant accessories are rather categorized in the plants
category
The second query returned actual plants since it searched the index for items containing the plants
keyword, which are mostly plants.
It also searched the plants
category, which exists in your index.
Many reasons can cause such discrepancies in the search results returned for a specific term when queried in its singular versus plural form, but here are a few things you should verify if you want singular and plural searches to return more consistent results:
Populate item bodies
By default, the Catalog source creates an item body by using the information contained in the ec_name
and ec_description
fields of an item (see Commerce standard fields reference).
Populating the content of these fields in the item’s body is crucial for queries to effectively target your items.
You can verify whether these fields are populated in your product by using the Content Browser (platform-ca | platform-eu | platform-au).
See Review item properties for instructions on how to inspect your items' fields.
Verify that the category field leverages stemming
The ec_category
field is used to identify a product’s category, and must have the Stemming option enabled.
In the previous example, plants weren’t returned by the plant
query because the ec_category
field didn’t have the Stemming option enabled, which caused the query to search only for an exact match when targeting the field.
See About stemming for more information on how the Coveo index handles stemming.
To verify whether the category field has Stemming enabled
-
Access the Fields (platform-ca | platform-eu | platform-au) page of the Coveo Administration Console.
-
Find the field you use to identify your product categories (typically the
ec_category
field). -
Verify whether the Stemming option is enabled.
-
If the option isn’t enabled, activate the option, and then click Save.
You then need to rebuild your source for the change to be effective.
Verify the query pipeline configuration
Coveo-powered commerce implementations require specific query pipeline configurations.
Depending on the Coveo API you use to power your commerce implementation, you must ensure that your query pipeline is configured as recommended.
-
If your commerce implementation relies on the Coveo Commerce API, refer to the query pipeline configuration section of the Coveo Merchandising Hub setup guide to ensure your query pipeline is configured as recommended.
-
If your commerce implementation relies on the Search API, refer to the Recommended query pipeline configurations to ensure your query pipeline is configured as recommended.