Handling indirect price filter in query with rules

Published November 23, 2021
Modules
Difficulty

“Cheap” presumably isn’t a value of any attribute of the indexed products. You can set a rule to properly handle a query phrase entered by the customer. Filtering will be used to ensure that only products that meet the “cheap” requirement are returned. The range considered cheap depends on your business, but for the purpose of this example let’s consider any price below $50 cheap. We will set a rule, where if the word “cheap” appears in the query the returned products will be filtered to the ones that have prices of $50 or less.

The query rule view before changing its default settings
The query rule view before changing its default settings

Requirements


  • The Search Engine must be enabled for your workspace.
  • The “price” attribute must be added to filterable attributes.

How to do it


  1. Go to AI Search > Indexes.
  2. Choose the Index for which you want to apply the rule.
  3. Go to the Rules tab.
  4. Click Add rule.
  5. In the Conditions section click the Define button.
  6. The Query option is selected by default. From the If query dropdown menu, select contains.
  7. In the Phrase input, type cheap.
  8. Click Apply.
  9. In the Consequences section, click the Define button.
  10. Click Add consequence and from the dropdown menu choose Filter query results.
  11. Click Add filter and from the dropdown menu choose the attribute that contains the price of your products.
  12. From the dropdown menu to the right of the attribute, choose Less than or equals.
  13. In the next input, specify the maximum price of items displayed in the search results. In our example, it is 50.
  14. Click Apply.
  15. Optionally, you can schedule your rule to be active from a start date to an end date. To do so, click Define in the Schedule section. Otherwise, your rule will be active immediately, with no end date.
  16. In the top left corner of the screen, name your rule.
  17. In the top right corner of the screen, click Save & Publish button.

Read more


Read more about rules.

😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker