clearance:true, whenever there is an empty query and the context is set to landing.
You can use other consequences, such as promoting or hiding items, and boosting or burying categories, with the same condition.
To trigger this rule, you must send landing as a ruleContexts on the frontend.
As soon as user begins typing, the rule is turned off.
If you want a rule that’s always active for a particular context regardless of the query string, create a context-only rule.
For more information, see Using rules to customize search results by platform.
To boost, bury, or on values of a certain attribute, you must declare that attribute as an
attributesForFaceting.Using the API
To run the code examples on this page, install the latest API client. To create a rule with one of the API clients, use thesaveRule method on a rule object with an empty search as the condition.
Using the dashboard
You can create this rule from the Algolia dashboard using either the Visual Editor or the Manual Editor. To match empty queries regardless of context, omit the context in either editor.- Visual Editor
- Manual Editor
- In the Algolia dashboard, select your application and index, open Rules, and select New rule > Visual Editor.
- In Conditions, click Set query condition(s).
Keep Query toggled on, select is, and leave the search input empty.
Toggle Context on, enter
landing, and click Apply. - In Consequences, select Boost categories.
Select
clearanceas the attribute andtrueas its value, then click Apply. - Review the results and click Review and Publish. To forward the rule to replicas or other indices, select them under Copy this rule to other indices and/or replicas. Click Publish, or use Save as Draft to keep the rule inactive.
In JSON, you must write string values inside quotation marks, and number values and booleans without quotations.