Skip to main content
Sometimes, you may want to use a rule to hide based on what users are searching for. For example, consider a user searching for “cheap laptops” on an ecommerce site. Without a rule, cheap and premium laptops will appear in the search results. By applying a rule where:
  • Condition: query contains “cheap”
  • Consequence: hide items where the product_range attribute is premium
Users searching for cheap laptops will only see the more affordable options in the search results. To hide one or more items, use one of the Algolia API clients or the Algolia dashboard’s Visual Editor. You can also hide individual items with the Algolia dashboard’s Manual Editor.
You can hide up to 50 items per rule.

Using an API client

To run the code examples on this page, install the latest API client. This example uses the saveRule method to hide a record if the query contains the word “cheap”.

Using the dashboard

Use the Visual Editor to hide items by attribute. To hide individual items, use either the Visual Editor or the Manual Editor.

Hide items by attribute

  1. Go to the Algolia dashboard and select your Algolia . On the left sidebar, select Search, select your index, and open Rules. Select Create your first rule or New rule, then select Visual Editor.
  2. Click Set query condition(s), enter cheap, and click Apply.
  3. In Consequences, click Hide items and select Hide by attribute. Enter product_range as the attribute and premium as the value, then click Apply.
  4. Review the results, click Review and Publish, and click Publish.

Hide individual items

You can hide individual items using either editor.
  1. Open Rules and select New rule > Visual Editor.
  2. Click Set query condition(s), select contains, enter cheap, and click Apply.
  3. In Consequences, click Hide items and select Hide by item. In Search items to hide, search for the record you want to hide and select it. Click Hide multiple items to select more records, then click Apply.
  4. Review the results, click Review and Publish, and click Publish.

See also

Last modified on September 28, 2026