docs: fix filters in meilisearch and algolia guides (#14098)
This commit is contained in:
@@ -540,9 +540,14 @@ You can now create the workflow that syncs the products to Algolia.
|
||||
To create the workflow, create the file `src/workflows/sync-products.ts` with the following content:
|
||||
|
||||
```ts title="src/workflows/sync-products.ts"
|
||||
import { createWorkflow, WorkflowResponse } from "@medusajs/framework/workflows-sdk"
|
||||
import {
|
||||
createWorkflow,
|
||||
transform,
|
||||
WorkflowResponse
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
|
||||
import { syncProductsStep, SyncProductsStepInput } from "./steps/sync-products"
|
||||
import { ProductStatus } from "@medusajs/framework/utils"
|
||||
|
||||
type SyncProductsWorkflowInput = {
|
||||
filters?: Record<string, unknown>
|
||||
@@ -553,6 +558,14 @@ type SyncProductsWorkflowInput = {
|
||||
export const syncProductsWorkflow = createWorkflow(
|
||||
"sync-products",
|
||||
({ filters, limit, offset }: SyncProductsWorkflowInput) => {
|
||||
const productFilters = transform({
|
||||
filters
|
||||
}, (data) => {
|
||||
return {
|
||||
status: ProductStatus.PUBLISHED,
|
||||
...data.filters
|
||||
}
|
||||
})
|
||||
const { data, metadata } = useQueryGraphStep({
|
||||
entity: "product",
|
||||
fields: [
|
||||
@@ -571,10 +584,7 @@ export const syncProductsWorkflow = createWorkflow(
|
||||
take: limit,
|
||||
skip: offset,
|
||||
},
|
||||
filters: {
|
||||
status: "published",
|
||||
...filters,
|
||||
},
|
||||
filters: productFilters,
|
||||
})
|
||||
|
||||
syncProductsStep({
|
||||
@@ -898,6 +908,7 @@ export default async function handleProductEvents({
|
||||
input: {
|
||||
filters: {
|
||||
id: data.id,
|
||||
status: "published",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -520,9 +520,14 @@ You can now create the workflow that syncs products to Meilisearch.
|
||||
To create the workflow, create the file `src/workflows/sync-products.ts` with the following content:
|
||||
|
||||
```ts title="src/workflows/sync-products.ts"
|
||||
import { createWorkflow, WorkflowResponse } from "@medusajs/framework/workflows-sdk"
|
||||
import {
|
||||
createWorkflow,
|
||||
transform,
|
||||
WorkflowResponse
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
|
||||
import { syncProductsStep, SyncProductsStepInput } from "./steps/sync-products"
|
||||
import { ProductStatus } from "@medusajs/framework/utils"
|
||||
|
||||
type SyncProductsWorkflowInput = {
|
||||
filters?: Record<string, unknown>
|
||||
@@ -533,6 +538,14 @@ type SyncProductsWorkflowInput = {
|
||||
export const syncProductsWorkflow = createWorkflow(
|
||||
"sync-products",
|
||||
({ filters, limit, offset }: SyncProductsWorkflowInput) => {
|
||||
const productFilters = transform({
|
||||
filters
|
||||
}, (data) => {
|
||||
return {
|
||||
status: ProductStatus.PUBLISHED,
|
||||
...data.filters
|
||||
}
|
||||
})
|
||||
const { data, metadata } = useQueryGraphStep({
|
||||
entity: "product",
|
||||
fields: [
|
||||
@@ -551,10 +564,7 @@ export const syncProductsWorkflow = createWorkflow(
|
||||
take: limit,
|
||||
skip: offset,
|
||||
},
|
||||
filters: {
|
||||
status: "published",
|
||||
...filters,
|
||||
},
|
||||
filters: productFilters,
|
||||
})
|
||||
|
||||
syncProductsStep({
|
||||
@@ -883,6 +893,7 @@ export default async function handleProductEvents({
|
||||
input: {
|
||||
filters: {
|
||||
id: data.id,
|
||||
status: "published",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -6039,7 +6039,7 @@ export const generatedEditDates = {
|
||||
"app/troubleshooting/workflow-errors/step-x-defined/page.mdx": "2025-03-21T07:09:02.741Z",
|
||||
"app/troubleshooting/workflow-errors/when-then/page.mdx": "2025-03-21T08:35:45.145Z",
|
||||
"app/how-to-tutorials/tutorials/abandoned-cart/page.mdx": "2025-06-26T11:45:57.112Z",
|
||||
"app/integrations/guides/algolia/page.mdx": "2025-10-31T16:37:38.241Z",
|
||||
"app/integrations/guides/algolia/page.mdx": "2025-11-20T15:20:38.696Z",
|
||||
"app/integrations/guides/magento/page.mdx": "2025-10-09T11:30:09.533Z",
|
||||
"app/js-sdk/auth/overview/page.mdx": "2025-03-28T08:05:32.622Z",
|
||||
"app/how-to-tutorials/tutorials/loyalty-points/page.mdx": "2025-10-09T11:27:14.961Z",
|
||||
@@ -6600,7 +6600,7 @@ export const generatedEditDates = {
|
||||
"references/core_flows/Locking/Steps_Locking/variables/core_flows.Locking.Steps_Locking.acquireLockStepId/page.mdx": "2025-09-15T09:52:14.218Z",
|
||||
"references/core_flows/Locking/Steps_Locking/variables/core_flows.Locking.Steps_Locking.releaseLockStepId/page.mdx": "2025-09-15T09:52:14.219Z",
|
||||
"references/core_flows/Locking/core_flows.Locking.Steps_Locking/page.mdx": "2025-09-15T09:52:14.217Z",
|
||||
"app/integrations/guides/meilisearch/page.mdx": "2025-10-31T16:38:53.945Z",
|
||||
"app/integrations/guides/meilisearch/page.mdx": "2025-11-20T15:21:44.830Z",
|
||||
"app/nextjs-starter/guides/storefront-returns/page.mdx": "2025-09-22T06:02:00.580Z",
|
||||
"references/js_sdk/admin/Admin/properties/js_sdk.admin.Admin.views/page.mdx": "2025-10-31T09:41:41.343Z",
|
||||
"app/data-model-repository-reference/methods/create/page.mdx": "2025-10-28T16:02:14.959Z",
|
||||
|
||||
Reference in New Issue
Block a user