chore(docs): Generated References (#9551)
Generated the following references: - `api_key` - `auth` - `cart` - `core_flows` - `currency` - `customer` - `fulfillment` - `inventory_next` - `modules` - `modules_sdk` - `order` - `order_models` - `payment` - `payment_provider` - `pricing` - `product` - `promotion` - `region` - `sales_channel` - `search` - `stock_location_next` - `store` - `tax` - `types` - `user` - `utils` - `workflows` Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
1 parent
089d4af301
commit
224e530453
393 files changed
+384350
-379636
No files matched your search
@@ -24,7 +24,7 @@ npm install @medusajs/utils
|
||||
A search service class is in a TypeScript or JavaScript file created in the `src/services` directory. The class must extend the `AbstractSearchService` class imported
|
||||
from the `@medusajs/utils` package.
|
||||
|
||||
Based on services’ naming conventions, the file’s name should be the slug version of the search service’s name without `service`, and the class’s name should be the
|
||||
Based on services’ naming conventions, the file’s name should be the slug version of the search service’s name without `service`, and the class’s name should be the
|
||||
pascal case of the search service’s name following by `Service`.
|
||||
|
||||
For example, create the `MySearchService` class in the file `src/services/my-search.ts`:
|
||||
@@ -34,7 +34,7 @@ import { AbstractSearchService } from "@medusajs/utils"
|
||||
|
||||
class MySearchService extends AbstractSearchService {
|
||||
isDefault = false
|
||||
|
||||
|
||||
createIndex(indexName: string, options: Record<string, any>) {
|
||||
throw new Error("Method not implemented.")
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class MySearchService extends AbstractSearchService {
|
||||
}
|
||||
search(
|
||||
indexName: string,
|
||||
query: string,
|
||||
query: string,
|
||||
options: Record<string, any>
|
||||
) {
|
||||
return {
|
||||
@@ -74,7 +74,7 @@ class MySearchService extends AbstractSearchService {
|
||||
}
|
||||
}
|
||||
updateSettings(
|
||||
indexName: string,
|
||||
indexName: string,
|
||||
settings: Record<string, any>
|
||||
) {
|
||||
throw new Error("Method not implemented.")
|
||||
@@ -89,7 +89,7 @@ export default MySearchService
|
||||
|
||||
## Notes About Class Methods
|
||||
|
||||
Although there are several helper methods in this class, the main methods used by the Medusa backend are `addDocuments`, `deleteDocument`, and `search`.
|
||||
Although there are several helper methods in this class, the main methods used by the Medusa backend are `addDocuments`, `deleteDocument`, and `search`.
|
||||
The rest of the methods are provided in case you need them for custom use cases.
|
||||
|
||||
---
|
||||
@@ -182,7 +182,7 @@ class MeiliSearchService extends AbstractSearchService {
|
||||
|
||||
#### Parameters
|
||||
|
||||
<TypeList types={[{"name":"indexName","type":"`string`","description":"The name of the index to create.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`unknown`","description":"Any options that may be relevant to your search service. This parameter doesn't have \nany defined format as it depends on your custom implementation.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createIndex"/>
|
||||
<TypeList types={[{"name":"indexName","type":"`string`","description":"The name of the index to create.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`unknown`","description":"Any options that may be relevant to your search service. This parameter doesn't have\nany defined format as it depends on your custom implementation.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="createIndex"/>
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -334,7 +334,7 @@ class MySearchService extends AbstractSearchService {
|
||||
|
||||
This method is used to search through an index by a query.
|
||||
|
||||
In the Medusa backend, this method is used within the [Search Products API Route](https://docs.medusajs.com/api/store#products\_postproductssearch)
|
||||
In the Medusa backend, this method is used within the [Search Products API Route](https://docs.medusajs.com/api/store#products\_postproductssearch)
|
||||
to retrieve the search results. The API route's response type is an array of items, though the item's format is not defined as it depends on the
|
||||
data returned by this method.
|
||||
|
||||
@@ -370,7 +370,7 @@ class MySearchService extends AbstractSearchService {
|
||||
|
||||
This method is used to update the settings of an index within the search service. This is useful if you want to update the index settings when the plugin options change.
|
||||
|
||||
For example, in the Algolia plugin, a loader, which runs when the Medusa backend loads, is used to update the settings of indices based on the plugin options.
|
||||
For example, in the Algolia plugin, a loader, which runs when the Medusa backend loads, is used to update the settings of indices based on the plugin options.
|
||||
The loader uses this method to update the settings.
|
||||
|
||||
#### Example
|
||||
|
||||
Reference in new issue
Block a user