docs: fix filters in meilisearch and algolia guides (#14098)

This commit is contained in:
Shahed Nasser
2025-11-24 08:53:29 +02:00
committed by GitHub
parent 32eaa9dd81
commit b3f4ddc27c
4 changed files with 73 additions and 29 deletions

View File

@@ -24310,7 +24310,7 @@ While this is the recommended way to create a Medusa application, you can altern
### Prerequisites
- [Node.js v20+](https://nodejs.org/en/download)
- [Node.js v20+ (LTS versions)](https://nodejs.org/en/download)
- [Git CLI tool](https://git-scm.com/downloads)
- [PostgreSQL](https://www.postgresql.org/download/)
@@ -44095,6 +44095,8 @@ Learn more about the Caching Module in the [Caching Module guide](https://docs.m
In this guide, you'll learn about the Caching Module and its providers.
Refer to the [Medusa Cache Cloud](https://docs.medusajs.com/cloud/cache/index.html.md) guide for setting up the Caching Module in Cloud.
The Caching Module is available starting [Medusa v2.11.0](https://github.com/medusajs/medusa/releases/tag/v2.11.0). It replaces the deprecated [Cache Module](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/infrastructure-modules/cache/index.html.md).
## What is the Caching Module?
@@ -44117,14 +44119,12 @@ If you're using the Cache Module in your application, refer to the [migrate to t
## Install the Caching Module
### Prerequisites
- [Redis installed and Redis server running](https://redis.io/docs/getting-started/installation/)
The Caching Module is installed by default in your application. To use it, enable the caching feature flag and register the module in your `medusa-config.ts` file.
{/* <Note title="Cloud user?">
Caching features are enabled by default for Cloud users. Learn more in the [Medusa Cache](!cloud!/cache) guide.
</Note> */}
### 1. Enable Caching Feature Flag
The caching feature is currently behind a feature flag. To enable it, set the `MEDUSA_FF_CACHING` environment variable to `true` in your `.env` file:
@@ -90318,9 +90318,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>
@@ -90331,6 +90336,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: [
@@ -90349,10 +90362,7 @@ export const syncProductsWorkflow = createWorkflow(
take: limit,
skip: offset,
},
filters: {
status: "published",
...filters,
},
filters: productFilters,
})
syncProductsStep({
@@ -90656,6 +90666,7 @@ export default async function handleProductEvents({
input: {
filters: {
id: data.id,
status: "published",
},
},
})
@@ -98171,9 +98182,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>
@@ -98184,6 +98200,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: [
@@ -98202,10 +98226,7 @@ export const syncProductsWorkflow = createWorkflow(
take: limit,
skip: offset,
},
filters: {
status: "published",
...filters,
},
filters: productFilters,
})
syncProductsStep({
@@ -98514,6 +98535,7 @@ export default async function handleProductEvents({
input: {
filters: {
id: data.id,
status: "published",
},
},
})