Debugging Rules
On this page
When you have a large set of Rules, it may be difficult to understand which Rules apply to a given query. Algolia provides tools to help you with this.
The usual getRankingInfo parameter triggers extra information about Rules:
- Promoted hits are labelled with a
"promoted": truefield inside the_rankingInfoobject. This field is omitted from regular hits. - The list of applied Rules is available inside the
appliedRulestop-level field. This field is omitted when no Rule has been applied (even ifenableRulesis true).
The params response field also has search parameters after Rule application, and as such reflects the side-effects of the Rules.
When in doubt, you can always run the same query with enableRules=false and compare the results you get with and without Rules.
Improving Rules accuracy
Sometimes, creating Rules can lead to lower search accuracy. The following table lists common causes for a lower-than-expected search accuracy when applying Rules.
| Cause of less accurate results | Solution |
|---|---|
| Not adding a “remove word” consequence when turning search phrases into query parameters | Add a remove word consequence after any add query parameter consequence |
| Not creating an optional filter as a facet | If you want to use an attribute as an optional filter, declare it as a facet |
| Not taking advantage of “add search parameter” consequences | See some common uses for this consequence |