mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 09:41:04 +01:00
Replace the drop-one-character pg_trgm word_similarity approach with a per-token Levenshtein check via fuzzystrmatch. The variant approach generated noisy matches (e.g. "serac" -> "service", "seach" -> any word containing "each") that surfaced unrelated issues at the top of fuzzy result sets. The new approach requires every fuzzy-eligible query token to land within an edit distance budget of at least one title word, where the budget is gated on the SHORTER of the two strings: shared length 6+: max 2 edits shared length 5: max 1 edit shared length 4: exact match only That budget catches "serach" -> "search" (lev=2), "mibile" -> "mobile" (lev=1) and "mobail" -> "mobile" (lev=2), while rejecting trigram-style collisions like "serach" vs "each" (length-4 word, exact required) or "reach" (length-5, lev=2 > 1). Adds migration 0077 to enable the fuzzystrmatch contrib extension. Co-Authored-By: Paperclip <noreply@paperclip.ing>