An implementation of Algolia through the GraphQL Mesh.
Make sure the Magento 2 module is correctly installed and working.
-
Find current version of your
@graphcommerce/next-ui
in your package.json. -
yarn add @graphcommerce/algolia-mesh@9.0.0
(replace 9.0.0 with the version of the step above) -
Configure the following (configuration values) in your graphcommerce.config.js:
const config = { algolia: { applicationId: 'your-algolia-application-id', // Stores > Configuration > Algolia Search > Credentials and Basic Setup > Application ID indexNamePrefix: 'default_', // Stores > Configuration > Algolia Search > Credentials and Basic Setup > Index name prefix searchOnlyApiKey: 'blabla', // Stores > Configuration > Algolia Search > Credentials and Basic Setup > Search-only (public) API key catalogEnabled: false, // start with search and if everything works as expected, you can move on to the catalog. }, }
- Setup the fields that you want to index in algolia
Stores > configuration > Algolia Search > Products > Products
- Configure your aggregations/filters, make sure that the aggregation fields
are also indexed in step 2
Stores > Configuration > Algolia Search > Instant Search Results Page > Facets
- Make sure the aggregations fields are made filterable(Use in layerd
Navigation), so the attributeList query can retrieve the labels.
Stores > Products > Attributes
- To configure sorting options, enable Virtual Replica's.
Stores > Configuration > Algolia Search > Instant Search Results Page > Use Virtual Replica
const config = {
algoliaCustomerGroupPricingEnabled: true,
}
To enable customer group pricing, make sure customers groups prices are mapped
to algolia.
Stores > Configuration > Algolia Search > Advanced > Enable Customer Groups
.
[Product] > Advanced Pricing > Customer Group Price
gets indexed.
Note: The GraphQL API does not expose the customer group_id by default. We're doing an additional REST API call to get the value. This means a somewhat slower (few hundred ms) when the Customer is loaded.
By default algoliaFacetsToAggregations and algoliaHitToMagentoProduct can be plugged in.
Sorting is defined by Algolia and can not be configured per category as each sorting option is a separate (virtual) index.
To get query suggestions/autocomplete enter your Algolia dashboard > Search > configure > Query Suggestions > new Query Suggestions Index. This will create a new index which will be used for suggestions
Don't mind to use the suggestions setting in magento admin. It will create a suggestions index but it will not record suggestions. This requires instantSearch
- [] Category search / Additional indexes
- [] Highlighting