MedusaSearchQueryAdapter
Product search answered by Medusa's own Search module, through POST /store/search, against the index @evolve-framework/medusa-plugin-search declares.
import { MedusaSearchQueryAdapter } from "@evolve-framework/medusa/search";new MedusaSearchQueryAdapter(options: MedusaSearchQueryAdapterOptions)| Option | Type | Description |
|---|---|---|
clientFactory? | ClientFactory | Resolves a Store API client per store and locale. |
matching? | MedusaSearchMatching | How a typed term is matched. Left out, the last term is a prefix and a term that finds nothing is asked again with typos forgiven. |
facetLabels? | FacetLabels | Labels for attribute facets, by attribute name without |
categoryFacet? | boolean | Count products per category, under commercetools' |
maxResults? | number | The most hits the Search module's provider can page through. Medusa sets no limit itself; a provider backed by a search engine has that engine's. |
client? | Medusa | One Store API client, for a caller that already holds the right one. |
MedusaSearchMatching2The fields of matching.
| Field | Type | Description |
|---|---|---|
prefix? | booleanDefault: true | Read the last term as a prefix, since it is the one still being typed: "mountain bik" finds the mountain bikes. Off, every term has to be a complete word. |
typoFallback? | boolean | { fields: (locale: string) => string[]; }Default: true | Ask again, forgiving a typo, when a term finds nothing. MoreIt reads few fields on purpose. The Postgres provider matches a typo by trigram similarity over everything it is pointed at, with a fixed threshold: against descriptions a five-letter word resembles a fifth of a catalogue, and the query takes seconds. Against a title it stays a correction. |
| Method | Description |
|---|---|
init(): Promise<void> | Nothing to connect: every search is one request to Medusa. |
search(
query: ProductSearchQuery,
): Promise<SearchResponse<ProductDocument>> | Run a query and return the documents that matched. |

