Fuzzy search
fuzzy_searchRank PostgreSQL text column values by trigram similarity to a search term using pg_trgm. Choose word mode for matching fragments within longer text, or full mode for whole string comparison.
Instructions
Rank a text column's values by pg_trgm trigram similarity to a search term. mode='word' (default) matches fragments within longer text; mode='full' compares whole strings. Reports available=false if pg_trgm is not installed. Returns an object with available (bool), matches (list of {value, similarity} ranked by similarity descending), and mode.
Example: fuzzy_search(schema='public', table='users', column='name', term='janne', mode='word')
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | word | |
| term | Yes | ||
| limit | No | ||
| table | Yes | ||
| column | Yes | ||
| schema | Yes | ||
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. | |
| threshold | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| matches | Yes | ||
| available | Yes |