chore: Merge master to develop (#3653)
This commit is contained in:
@@ -1,25 +1,86 @@
|
||||
# medusa-plugin-algolia
|
||||
# Algolia
|
||||
|
||||
Algolia Plugin for Medusa to search for products.
|
||||
Provide powerful indexing and searching features in your commerce application with Algolia.
|
||||
|
||||
Learn more about how you can use this plugin in the [documentaion](https://docs.medusajs.com/add-plugins/algolia).
|
||||
[Algolia Plugin Documentation](https://docs.medusajs.com/plugins/search/algolia) | [Medusa Website](https://medusajs.com) | [Medusa Repository](https://github.com/medusajs/medusa)
|
||||
|
||||
## Options
|
||||
## Features
|
||||
|
||||
```js
|
||||
{
|
||||
applicationId: "someId",
|
||||
adminApiKey: "someApiKey",
|
||||
settings: {
|
||||
[indexName]: [algolia settings passed to algolia's `updateSettings()` method]
|
||||
// example
|
||||
products: {
|
||||
indexSettings: {
|
||||
searchableAttributes: ["title", "description", "variant_sku", "type_value"],
|
||||
attributesToRetrieve: ["title", "description", "variant_sku", "type_value"],
|
||||
}
|
||||
transformer: (product: Product) => ({ id: product.id })
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
- Flexible configurations for specifying searchable and retrievable attributes.
|
||||
- Ready-integration with [Medusa's Next.js starter storefront](https://docs.medusajs.com/starters/nextjs-medusa-starter).
|
||||
- Utilize Algolia's powerful search functionalities including typo-tolerance, query suggestions, results ranking, and more.
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [Medusa backend](https://docs.medusajs.com/development/backend/install)
|
||||
- [Algolia account](https://www.algolia.com/)
|
||||
|
||||
---
|
||||
|
||||
## How to Install
|
||||
|
||||
1\. Run the following command in the directory of the Medusa backend:
|
||||
|
||||
```bash
|
||||
npm install medusa-plugin-algolia
|
||||
```
|
||||
|
||||
2\. Set the following environment variables in `.env`:
|
||||
|
||||
```bash
|
||||
ALGOLIA_APP_ID=<YOUR_APP_ID>
|
||||
ALGOLIA_ADMIN_API_KEY=<YOUR_ADMIN_API_KEY>
|
||||
```
|
||||
|
||||
3\. In `medusa-config.js` add the following at the end of the `plugins` array:
|
||||
|
||||
```js
|
||||
const plugins = [
|
||||
// ...
|
||||
{
|
||||
resolve: `medusa-plugin-algolia`,
|
||||
options: {
|
||||
application_id: process.env.ALGOLIA_APP_ID,
|
||||
admin_api_key: process.env.ALGOLIA_ADMIN_API_KEY,
|
||||
settings: {
|
||||
products: {
|
||||
searchableAttributes: ["title", "description"],
|
||||
attributesToRetrieve: [
|
||||
"id",
|
||||
"title",
|
||||
"description",
|
||||
"handle",
|
||||
"thumbnail",
|
||||
"variants",
|
||||
"variant_sku",
|
||||
"options",
|
||||
"collection_title",
|
||||
"collection_handle",
|
||||
"images",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Test the Plugin
|
||||
|
||||
1\. Run the following command in the directory of the Medusa backend to run the backend:
|
||||
|
||||
```bash
|
||||
npm run start
|
||||
```
|
||||
|
||||
2\. Try searching products either using your storefront or using the [Store APIs](https://docs.medusajs.com/api/store#tag/Product/operation/PostProductsSearch).
|
||||
|
||||
---
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Algolia Plugin Documentation](https://docs.medusajs.com/plugins/search/algolia)
|
||||
|
||||
Reference in New Issue
Block a user