Search results
The Search Results list includes all products that match the search criteria entered in the Quick Search box or the Advanced Search form. Every product list in the catalog has essentially the same controls. The only difference is that one is the result of a search query, and the other difference is the result of navigation.
The results can be formatted as either a grid or list and sorted by a selection of attributes. Pagination controls appear if there are more products than fit on the page. Use these controls to move from one page to the next. The number of records per page is determined by the Catalog Frontend configuration. For more information, see Product Listings.
With ElasticSearch:
- There is no out-of-the-box support for search by the suffix. For example, search by SKU may not return the expected result if the keyword contains only the end part of the SKU.
- There is out-of-the-box support for search by prefix (partial keyword search) for
name
andsku
product attributes only. All other product attributes are searched by the whole keyword, with the exact matching. - Search results for
name
andsku
product attributes are based on the relevance, not exact matching. The most relevant matches, such as an exactly matched Product Name or SKU, are listed first. To search for an exact match, the customer can use double quotes in the search query. For example, aWSH12-32-Red
search query may return several products, sorted by the relevance. But a"WSH12-32-Red"
search query returns only one product with the exactly matchedsku
.
{width="700" modal="regular"}
Keyword mapping to extend search results
This technique uses an attribute to create a keyword-based association between two products so that a search for either product returns results for both products. You can use keyword mapping to promote a product in search results where it otherwise would not appear.
{width="700" modal="regular"}
The following example uses keyword mapping based on SKU. When either SKU is entered in the search box, both products appear in the results. The SKUs of the following configurable products are mapped, rather than the SKUs of product variations:
- Montana Wind Jacket (MJ03)
- Chaz Kangaroo Hoodie (MH01)
Step 1: Create an attribute
-
In the Products list, open the
Montana Wind Jacket
(MJ03) in edit mode. -
In the upper-right corner, click Add Attribute.
-
On the Select Attribute page, click Create New Attribute.
-
Complete the attribute properties as follows:
Attribute Properties
- Attribute Label -
Search Keywords
- Catalog Input Type for Store Owner -
Text Field
Advanced Attribute Properties
- Add to Column Options -
Yes
(default) - Use in Filter Options -
Yes
(default)
Storefront Properties
- Use in Search -
Yes
- Visible on Catalog Pages in the Storefront -
No
- Used in Product Listings -
No
- Attribute Label -
-
When complete, click Save Attribute.
The attribute is added to the attribute set for the product.
Step 2: Map the first product
-
On the product settings page, scroll down and expand the Attributes section.
-
In the Search Keywords field, enter the SKU
MH01
that is to be mapped to this product.You can enter multiple SKUs separated by a space in the Search Keywords field. In this example, only one is entered.
{width="600" modal="regular"}
-
When complete, click Save.
-
Go to System > Tools > Cache Management and refresh the Page Cache.
Step 3: Map the second product
- In the Products list, open the
Chaz Kangaroo Hoodie
(MH01) in edit mode. - Scroll down and expand the Attributes section.
- In the Search Keywords field, enter the SKU for the other product,
MJ03
. - Click Save.
- Go to System > Tools > Cache Management and refresh the Page Cache.
Step 4: Test it in the storefront
- Go to the storefront and enter
MJ03
in the Quick Search box. - Verify that both products are returned in the search results list.
Weighted Search
Product attributes that are enabled for catalog search can be assigned a weight to give them a higher value in search results. Attributes with a greater weight are returned before attributes with a lower weight. For example, if there are two attributes in the system, color with a search weight of 3 and description with a search weight of 1. A search for the word red returns a list of products with a color attribute value of red
at the top of the search results and returns products with descriptions that contain the word red at the bottom of the search results. In this example, the color
attribute has a greater defined weight than the description
attribute.
To set the search weight properties of an attribute:
-
On the Admin sidebar, go to Stores > Attributes > Product.
-
Find the attribute in the list and open in edit mode.
-
In the left panel, choose Storefront Properties and do the following:
-
To include the attribute in search queries, set Use in Search to
Yes
. -
To establish the search value of the attribute, set Search Weight to a number from 1 to 10, where
10
has the highest priority. If no value is entered, all attributes default to a search weight of1
.
{width="600" modal="regular"}
-
-
When complete, click Save Attribute.