Actions52
- Advanced Actions
- Api Keys Actions
- Clusters Actions
- Dictionaries Actions
- Indices Actions
- Records Actions
- Rules Actions
- Search Actions
- Synonyms Actions
- Vaults Actions
Overview
The "Save rule" operation in the Algolia node allows users to create or update a search rule within a specified index. A rule in Algolia is an if-then statement that modifies search results based on defined conditions and consequences. This operation is useful for customizing search behavior, such as boosting certain results, filtering, hiding records, or applying merchandising strategies.
Typical use cases include:
- Creating rules to promote specific products during sales.
- Hiding out-of-stock items from search results.
- Applying custom filters or facets dynamically based on user queries.
- Defining time-based validity for promotional rules.
For example, you might save a rule that promotes a particular product when a user searches for a related keyword or hides certain records during a specific time period.
Properties
| Name | Meaning |
|---|---|
| Index Name | The name of the Algolia index where the rule will be saved. |
| Object ID | Unique identifier for the rule object. |
| Forward To Replicas | Boolean indicating whether the rule should be forwarded to replica indices. |
| Multiple properties | Select which parts of the rule object to set. Options include: Object ID, Conditions, Consequence, Description, Enabled, Validity. |
| Conditions | Conditions that trigger the rule. These define when the rule applies based on query patterns or other criteria. |
| Consequence | Effects of the rule when triggered. Includes parameters like similarQuery, filters, facetFilters, optionalFilters, numericFilters, tagFilters, and many others controlling search behavior and merchandising actions. |
| Filter Promotes | Boolean indicating whether promoted records must match active filters to apply the consequence. |
| Hide | Records to hide from search results, specified by their object IDs. |
| Description | Text description of the rule's purpose for easier identification. |
| Enabled | Boolean indicating whether the rule is active. |
| Validity | Time periods (start and end in Unix epoch) when the rule is active. |
The Consequence property supports a wide range of detailed parameters to finely control search behavior, including but not limited to:
- Similar Query: Keywords used instead of the search query for broader search.
- Filters: Filter expressions to narrow down results.
- Facet Filters, Optional Filters, Numeric Filters, Tag Filters: Various filter types.
- Pagination controls: page, offset, length.
- Geolocation filters: aroundLatLng, aroundRadius, insideBoundingBox, insidePolygon.
- Personalization and analytics settings.
- Highlighting and snippet options.
- Ranking and sorting configurations.
- Advanced syntax and typo tolerance settings.
- Rendering content for UI customization.
- Semantic search settings (for NeuralSearch mode).
- Dynamic re-ranking options.
This extensive parameter list allows creating complex and precise rules tailored to specific search needs.
Output
The output of this operation is the response from the Algolia API after saving the rule. It typically includes confirmation of the saved rule and any metadata returned by Algolia. The main output is JSON data representing the saved rule object or the status of the operation.
No binary data output is involved in this operation.
Dependencies
- Requires an Algolia account with appropriate API credentials (API key and Application ID).
- The node uses these credentials to authenticate requests to the Algolia API.
- The index specified must exist or be creatable by the user.
- Proper permissions are required to create or update rules in the target index.
Troubleshooting
- Invalid Object ID: Ensure the Object ID provided is unique and valid.
- Permission errors: Verify that the API key used has rights to modify rules on the specified index.
- Malformed conditions or consequences: Carefully format JSON or structured inputs for conditions and consequences according to Algolia's documentation.
- Forward to replicas issues: If forwarding to replicas fails, check replica index configurations and permissions.
- Time validity errors: Ensure 'from' and 'until' times in validity are valid Unix timestamps and logical (start before end).
- API rate limits: Be aware of Algolia's indexing rate limits; batch operations may be preferred for multiple rules.
Common error messages usually come directly from Algolia's API and indicate issues with authentication, input validation, or rate limiting.
Links and References
- Algolia Rules Documentation
- Conditions Reference
- Consequences Reference
- Managing Rules API
- Algolia API Rate Limits
This summary is based solely on static analysis of the provided node configuration and property definitions for the "Rules" resource and "Save rule" operation.