Define attributes
The attribute filters allow you to define which item features are available in the search results, which features the customers can use to filter the results, and so on.
Configuration
- Go to AI Search.
- Create or select the index on the list.
- Go to the Settings tab.
- Each attribute type has a separate section, to select or remove added attributes on the dedicated section, click Define. You can define the following attributes:
Response attributes
This section defines which attributes will be included in the search response. For each item returned, only attributes defined in this section will be available in the search response. Only attributes defined in this section will be available in the search response so you can show them to the customers.
Filterable attributes
Filterable attributes are those that are enabled for use in item filters for including or excluding results.
Including an attribute value narrows down the search results to items with that attribute value. Excluding values of an attribute displays results with items that have different values of these attributes.
Examples
- Products in your catalog have the
sale
attribute which can take thetrue
(on sale) orfalse
value. Includesale
as a filterable attribute. Now, you can filter the results by the items’ sale status. - Products in your catalog have the
last_item
attribute that can take theyes
(one item is available) orno
(more than 1 item is on stock) values. Excludelast_item
as a filterable attribute. Now, you can filter the items that have one item left from the search results. - You want to filter out the products that cost more than $100. Include
price
as the range-type filterable attribute and in the settings, filter items whereprice
is equal to or greater than 100$.
Facetable attributes
Choose attributes that can be use as facets. Facets allow customers to sort search results by attributes and their values. For example, you can use the color
attribute as facetable to let the customers select which colors they’re interested in.
The search result also includes information how many items have a particular value of a facetable attribute.
For a live example, see our use cases. “Challenges”, “Channel”, “Difficulty”, and so on are facetable attributes.
Example
You want to give a customer a possibility to filter results by some attributes - color
and brand
. Add these attributes to the Facetable attributes section. When this is done, the customers will be able to narrow down the results of the filter to desired brand and color of the item and additionally they will be shown information about the number of items in each facet in the search response. This information can be displayed along with the search results and based on that filtering can be applied to the results.
- The returned facets in the search response contain the top 50 distinct attribute values.
- The sum of distinct attribute values, for filterable and facetable attributes, can’t exceed 10000.
That means that if the X attribute has 5000 different values and the Y attribute has 5000 different values, they cannot be used in filterable attributes at the same time. Remember that 10000 distinct values are shared for filterable AND facetable attributes. Therefore, we do not recommend filtering and/or faceting with attributes that have many distinct values in the item feed.
Sortable attributes
You can enable sorting the results by the chosen attributes. You can add both range and text attributes. Sorting by range attributes allows you to arrange the returned items from highest to lowest value of the specified attribute. Sorting by text attributes allows you to order the results in an alphabetic order, ascending or descending.
Disabling prefix search
You can disable the prefix search for specific attributes. This will prevent the search engine from trying to autocomplete the phrase for these attributes. Keep in mind that if the search engine will not find any items for the phrase it will still try to check for typos.