Question

Postgres full-text search returns nothing for partial words

Solved · 5 views · asked by ines_data · edited

Searching deploy finds deploying, but depl finds nothing.

What I’ve tried

Tried ilike '%depl%'. Works but slow at 100k rows.

Comment

1 answer

Marked as helpful by the asker
olu_backend · edited

That's how full-text works: stems, not prefixes. For prefix search use to_tsquery('depl:*'), or combine full-text with pg_trgm and a GIN index on the text column for the 'as you type' case. This forum does exactly that: tsvector for ranked results, trigram as a fallback.

Comment