Algolia API

Algolia is a hosted search engine that's integrated with Frontastic.

We're using version 3.0 of the Algolia library.

The backend part of the integration is within our API documentation in GitHub. To see any updates to this library, check out our libraries changelog.

You need to set productId as your attributeForDistinct either through the index creation or from the Algolia dashboard. The distinct default value should be false. See the Algolia documentation on attributeForDistinct for more information.

The item variation feature that Algolia provides (item variations) groups variants by product but will display only 1 variant (the most relevant) and hide the rest. You can find out more information in their documentation.

Prerequisites

  • You'll need to have an Algolia account
  • You'll need to create an index in Algolia with all your products and have the below properties for each variant:
    productId (variant grouping identifier)
    name
    slug
    sku
    price
    images []

You can also optionally store:
description
version
categories []
variantId
discountedPrice
currency
isOnStock

For more information on adding your data to Aloglia, see their documentation.

project.yml configuration

To access the APIs for Algolia, you'll need the below configuration added to your project.yml (see the project.yml article for more information):

configuration:
    productSearch:
        engine: algolia
    algolia:
        appId: OurAppID # this is your unique app ID for Algolia
        appKey: OurAppKey # this is your unique app key for Algolia
        indexName: Frontastic_search # this is the name of your index you have created for your data — you can only use 1 index

Available methods

Product search

See the Algolia ProductSearchAPI docs for arguments, types, and other information.

ProductSearchAPI method

Available?

getSearchableAttributes

yes

query (by query string)

yes

query (by category)

yes

query (by SKU) (deprecated)

n/a

query (by SKUs)

yes

query (by productId) (deprecated)

n/a

query (by productIds)

yes

query (by productType)

yes

query (by filters)

yes

query (facets)

yes

query (sortAttributes)

no

Known limitations

This integration is limited to products only.
You can't perform any sorting at query time.


Did this page help you?