-
Notifications
You must be signed in to change notification settings - Fork 634
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
Searching difficulties with hyphens (-) and periods (.) in assets #3080
Comments
Currently all search keywords that get inserted into the So "138-801.jpg" will end being saved as " 138 501 jpg " in the database, which is why your first four examples won't match. I think ultimately this will be solved in the Control Panel by #833 and/or #2060 |
Thanks @angrybrad, sounds good. Any idea why I'm seeing a different behavior for Entries (seem to be able to search for entries with hyphenated titles)? |
@timkelty actually, I was a bit off earlier. Looks like we run search input keywords through the same normalization process. I bet if you set both subLeft and subRight to true here it will match: https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#property-defaultsearchtermoptions |
Interessant. I was about to ask if such terms should be entered without the hyphens, etc., like certain maddening telephone etc. number forms. Glad to see your intent is rather 'the Craft Way' ;) Does at first seem subLeft ought to be default true, as subRight is, though. Something important I'm missing? (no doubt...) |
@angrybrad indeed, I changed
However, I'm not sure I understand why…(why would E.g. I can now search for I also don't understand why it seems to work without the |
@timkelty because all of the keywords in the Since 138 is the beginning of the string, you'd need the subleft to include the initial space. |
I see…a bit weird, but good enough until hopefully #833 and/or #2060 happens. Thanks, @angrybrad! |
I agree it's a bit awkward. Turns out search is pretty difficult. |
@angrybrad again, is there a reason not to default subLeft? Much agreed, search itself is ever a potential bandit -- this just seems it would ease a bit for use? (busy with other bandits here...) |
I have some prolbesm with my code. |
Hey, I deal with it. |
I've had clients have difficulties finding assets like the one shown above.
The following yield no results, which seems a bit broken:
138-501
,"138-501"
,138-501.jpg
,"138-501.jpg"
.…and I certainly can't ask them to search for
*138*501*jpg
:)I noticed that entries with hyphens still seem to be searchable (e.g. I can search for
e-mail
and get a result for an entry withe-mail
in the title), but the behavior is different with assets.The text was updated successfully, but these errors were encountered: