Skip to content

Fix quote matching in meeting name search#31

Open
sblack4 wants to merge 2 commits into
mainfrom
fix/28-smart-regex-quotes
Open

Fix quote matching in meeting name search#31
sblack4 wants to merge 2 commits into
mainfrom
fix/28-smart-regex-quotes

Conversation

@sblack4
Copy link
Copy Markdown
Collaborator

@sblack4 sblack4 commented Feb 15, 2026

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

  • Add makeQuoteFlexibleRegex() function that:
    • Escapes regex special characters
    • Replaces quotes with character classes (e.g., Joe'sJoe['']s)
  • Update pipelineFromQuery to transform nameQuery before regex matching
  • Add test cases for quote handling and regex escaping

Example

  • User searches: Joe's (straight apostrophe)
  • Backend creates regex: Joe['']s
  • Matches both: Joe's (straight) and Joe's (curly) ✓

Benefits

  • ✅ No database migration required
  • ✅ Works with existing data immediately
  • ✅ Simple, focused change
  • ✅ Easy to rollback if needed

Testing

  • Added unit tests for quote transformation
  • Existing tests still pass (simple strings unchanged)

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.
@sblack4 sblack4 requested a review from tim-rohrer March 1, 2026 20:32
Copy link
Copy Markdown
Collaborator

@tim-rohrer tim-rohrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search should ignore differences between straight and curly quotes

2 participants