Fuzzy Searching with tsvector

Looking for a match with an inexact input string or sequence is a form of fuzzy searching. Fuzzy searching means that what’s being searched isn’t known precisely. The user has supplied “approximately correct” text as search input, or possibly mistaken text, but still expects to get relevant search results back. Who can blame them, really? Modern search engines excel at taking approximate input and producing relevant search results.

Since these terms are familiar, let’s briefly discuss full-text search. Full-text search refers to the document text that is being searched. For Google or website search engines, this could be metadata from the site, or content within that site, that forms the document text to be searched. ...

Get High Performance PostgreSQL for Rails now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.