Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't force lowercase search term for generate_search_term_expression #2101

Open
wants to merge 2 commits into
base: 1.x
Choose a base branch
from

Conversation

alecritson
Copy link
Collaborator

Currently when scout is disabled, the search term is being forced to lowercase, meaning when doing a where query in the database with LIKE it's not matching any results.

This PR stops this behaviour so products can be matched.

Fixes #2094

Copy link

vercel bot commented Feb 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 8:12am

@glennjacobs
Copy link
Contributor

As MySQL LIKE is case-insensitive, how does it fix it?

@glennjacobs
Copy link
Contributor

I see that when using JSON it becomes a binary string, that IS case-sensitive.

@glennjacobs
Copy link
Contributor

I'm not sure this is the correct solution, as we don't want a case-sensitive search.

I would imagine we want to set both the field being searched upon and the keyword to be lowercase, to achieve a case-insensitive search.

So we'd retain the lowercasing of the keyword, but update the query to also lowercase the field in the LIKE comparison.

By using LOWER() in the query we can achieve this, and a bonus is that it's compatible with both MySQL and PostgreSQL.

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.

When trying to create a Product Association, the search engine does not find any products.
2 participants