Fix quote matching in meeting name search - #31
Conversation
Transform search queries to match both straight and curly quote variants using character classes in regex patterns. This fixes issue #28 where searching "Joe's Place" wouldn't match "Joe's Place" in the database. Implementation: - Add makeQuoteFlexibleRegex() to escape special chars and convert quotes to character classes (e.g., "Joe's" → "Joe['']s") - Update pipelineFromQuery to use the new function for nameQuery - Add test cases for quote handling and regex escaping No database changes required. Works with existing data. Fixes code4recovery/oiaa-direct#28
Keep inline regex explanations, drop JSDoc and standalone comments.
tim-rohrer
left a comment
There was a problem hiding this comment.
Any idea why the version in package-lock.json updated? Not that it is wrong, but it seems odd that some contributions lead to the file being updated, and others don't.
Previous version had character classes like `['']` and `[""]` where both inner chars were ASCII — visually rendered as if curly via editor font, but the bytes were duplicate U+0027 / U+0022. Regex deduped to plain straight quote, so curly variants were never matched. Use explicit ‘’ / “” escapes so source bytes are unambiguous. Add stringUtils.spec.ts exercising real RegExp.test() behavior on both quote variants (the original tests only compared pattern strings, which couldn't catch this). Remove two pipelineFromQuery tests now redundant with stringUtils.spec and pre-existing nameQuery wiring tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Update before merging — caught a bug in my own work: The character classes I wrote ( Commit
Re: the |
Fixes code4recovery/oiaa-direct#28
Problem
Search doesn't match meeting names when the only difference is between straight quotes (
"or') and curly quotes (""or''). For example, searching for "Joe's Place" wouldn't match "Joe's Place" in the database.Solution
Transform search queries to match both straight and curly quote variants using character classes in regex patterns.
Implementation
makeQuoteFlexibleRegex()function that:Joe's→Joe['']s)pipelineFromQueryto transformnameQuerybefore regex matchingExample
Joe's(straight apostrophe)Joe['']sJoe's(straight) andJoe's(curly) ✓Benefits
Testing