Search postgres
PostgreSQL search provider for Medusa, backed by tsvector and pg_trgm
@medusajs/search-postgres
Documentation | Website
Building blocks for digital commerce
PostgreSQL Search Module Provider for Medusa: full-text search, typo tolerance, filters, and facets over your search indexes, stored in the application's own PostgreSQL database. It's the default search provider, so search works without an external search engine. It ships with and is registered through the path.
At a glance
| Package | |
| Type | Module Provider (Search Module) |
| Provider ID | |
| Registered by default | Yes, with ( when self-hosted, on Medusa Cloud) |
| Import from |
Engines
| Engine | Where | Keyword search | Vector search |
|---|---|---|---|
| (default) | Any PostgreSQL database | PostgreSQL full-text search () with typo tolerance | Not supported |
| Medusa Cloud only | BM25 () with typo tolerance | ANN (), and hybrid keyword + vector search |
Features
- Free-text search with field weights and (default), , or (typeahead: the last term matches as a prefix).
- Filters with , , , , range operators, and / / . On array fields, a bare value or means "contains".
- Value, range, and stats facets scoped to the query's matches.
- (one hit per value) and .
- Vector and hybrid search on the engine. On , vector fields are dropped from the index with a warning, and vector queries are rejected.
Highlighting, geo fields, cursor pagination, and query-time locales aren't supported and are rejected.
Installation
No installation needed. The provider is a dependency of and is registered by default.
Usage
Register the provider yourself to pass options:
Then run the migrations, which enable the and extensions, create the text search configuration, and create your search indexes:
npx medusa db:migrateTo create or update only the search indexes, run .
If you set to anything other than , create a matching text search configuration yourself.
Configuration
| Option | Type | Description | Default |
|---|---|---|---|
| The search backend. works only on Medusa Cloud. | |||
| The PostgreSQL text search configuration language, such as or . | |||
| Turns text into an embedding. Required for vector fields that use and for . | - | ||
| Distance metric for vector indexes. |

