Algolia icon

Algolia

Use Algolia in your n8n workflows

Overview

The "Search synonyms" operation in the Algolia node allows users to search for synonym entries within a specified Algolia index. Synonyms are terms that the search engine treats as equivalent, improving search relevance by including alternative or related words. This operation is useful when you want to find existing synonyms configured in your index, for example, to review or manage them.

Typical use cases include:

  • Retrieving synonyms related to a specific query term.
  • Filtering synonyms by type (e.g., one-way synonyms, placeholders).
  • Paginating through large sets of synonyms.

Example: Searching for synonyms related to the word "car" in an index named "products" to see if alternative terms like "automobile" or "vehicle" exist.

Properties

Name Meaning
Index Name The name of the Algolia index where synonyms are stored and searched.
Search Synonyms Params Parameters to refine the search; options include:
- Query: Text string to search for synonyms.
- Type: Filter by synonym type (e.g., synonym, onewaysynonym, altcorrection1, placeholder).
- Page: Page number of results to retrieve (pagination).
- Hits Per Page: Number of synonym hits to return per page.
Query The actual search query string to find matching synonyms.
Type The type of synonym to filter by. Options include:
- synonym, onewaysynonym, altcorrection1, altcorrection2, placeholder, etc.
Page The page number of the search results to retrieve (starting at 0).
Hits Per Page Number of synonym records to return per page (minimum 1, maximum 1000).

Output

The output contains a JSON object with the search results for synonyms matching the provided criteria. The structure typically includes:

  • An array of synonym objects, each representing a synonym entry found in the index.
  • Pagination information such as current page, total hits, and hits per page.

Each synonym object may contain fields like:

  • objectID: Unique identifier of the synonym.
  • type: The synonym type.
  • synonyms: List of synonymous words or phrases.
  • Other properties depending on the synonym configuration.

No binary data is output by this node.

Dependencies

  • Requires an Algolia account with access to the specified index.
  • Requires an API key credential with permissions to read synonyms from the index.
  • The node uses Algolia's REST API endpoint /1/indexes/{indexName}/synonyms/search via POST requests.
  • The base URL is constructed using the Algolia application ID credential.

Troubleshooting

  • Invalid Index Name: If the specified index does not exist or is misspelled, the API will return an error. Verify the index name is correct.
  • Insufficient Permissions: Ensure the API key used has permission to read synonyms.
  • Empty Results: If no synonyms match the query or filters, the result will be empty. Try broadening the query or removing filters.
  • Pagination Issues: If requesting a page number beyond available pages, the response may be empty. Adjust the page parameter accordingly.
  • Invalid Parameter Values: Ensure numeric parameters like page and hitsPerPage are within valid ranges (e.g., hitsPerPage between 1 and 1000).

Links and References

Summary

This node operation enables searching for synonyms within an Algolia index, supporting filtering by query text, synonym type, and pagination controls. It is essential for managing and reviewing synonym configurations to enhance search relevance in Algolia-powered applications.

Discussion