How pg_trgm fixed empty product search for misspelled Hebrew and English queries
The ramo.co.il tools catalog returned no results when customers mistyped a word, because its ILIKE matcher required an exact substring. Product titles mix Hebrew text with Latin brand names and model numbers, and shoppers often combine scripts or misspell each half independently, which made the problem common rather than rare. Simple synonym lists and Hebrew stemming did not help, since the errors were typos rather than inflections. The team adopted PostgreSQL's pg_trgm extension, which scores strings by shared three-character slices and so still gives partial credit for a single wrong letter. They store one concatenated search column per product and combine whole-string and word-level similarity scores, with a 0.3 threshold for queries of four or more characters. Very short queries stay on prefix matching, and a keyboard-layout mapping covers queries typed in the wrong language.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in