Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

What is the goal of this PR and why is this important?

This PR makes workshop searches ignore hyphens in both user input and workshop data, improving search usability. Users can now find workshops regardless of hyphen variations in titles or text content (e.g., "self-care" vs "selfcare", "hello - goodbye" vs "hello goodbye").

How did you approach the change?

  • Workshop Model: Modified the title scope to use SQL REPLACE function to strip hyphens from both search input and database fields, with proper SQL injection protection via sanitize_sql_like
  • WorkshopSearchService: Updated filter_by_query method to use custom SQL that strips hyphens from search queries and applies REPLACE to all searchable workshop fields (title, full_name, objective, materials, setup, introduction, demonstration, etc., including Spanish variants)
  • Tests: Added comprehensive RSpec tests for hyphen-ignoring behavior in both title searches and full-text query searches with various hyphen patterns (-, --)

Anything else to add?

The implementation ensures bidirectional matching:

  • Searching "hello goodbye" finds workshops titled "hello - goodbye"
  • Searching "hello -- goodbye" finds workshops titled "hello goodbye"

All security checks passed with no vulnerabilities introduced. The changes are minimal and focused, affecting only the search behavior without impacting other functionality.

Original prompt

This section details on the original issue you should resolve

<issue_title>Make workshop text field searches ignore hyphens</issue_title>
<issue_description>Need to be stripped out of user input, and also adjust the workshop data against which it's being compared.</issue_description>

<agent_instructions>adjust the workshops index workshop search service to ignore matching against hyphens, esp in the workshop title.

so, if a user inputs "hello -- goodbye" into the search field, it'll find workshops w title (or text, depending on search field) "hello goodbye"
and, if a user inputs "hello goodbye" into the search field, it'll find workshop w title (or text, depending on search field) "hello - goodbye"</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@maebeale
Copy link
Collaborator

@copilot would you start again?

Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 27, 2026

@copilot would you start again?

I've implemented the hyphen-ignoring search functionality. The changes are in commit 5c9261a.

What was changed:

  • Modified the title scope in Workshop model to strip hyphens from both search input and database fields using SQL REPLACE
  • Updated filter_by_query in WorkshopSearchService to use custom SQL that strips hyphens from all searchable workshop fields
  • Added comprehensive tests for both title and query searches

How it works:

  • Searching "hello goodbye" now finds workshops titled "hello - goodbye"
  • Searching "hello -- goodbye" now finds workshops titled "hello goodbye"
  • Works bidirectionally for title searches and full-text query searches across all workshop text fields

All security checks passed with no vulnerabilities found.

Copilot AI changed the title [WIP] Make workshop text field searches ignore hyphens Make workshop text field searches ignore hyphens Jan 27, 2026
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.

Make workshop text field searches ignore hyphens

2 participants