I have a table with four language translated columns. E. g., if there is, for example, description data, there are four columns in database: description_en, description_de, description_it and description_fr.
I built an index and tsv::tsvector
column gathering all of those columns' data into one tsvector
-column.
Querying that table with tsv @@ to_tsquery(#{ search_query })
is nice, but I would like to match rows with search_query
being misspelled. In other words, to perform fuzzy search. Yet, I wish it to be as fast as possible as my table is really huge...
So I am wondering, is it ever possible in Postgres to match my tsv
column over metaphone(#{ search_query }, 2)
somehow?
So, for example, strings Herrenarmbanduhr
and heren
got matched.
UPD: I have some... medium amount of translated columns, so matching those with metaphone(column_a, 2) = metaphone(query, 2) OR metaphone(column_b, 2) = metaphone(query, 2)...
is a pain for me...