Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If you search on any two letters, all results are returned. We used to only search on three-letter strings.
Compare:
https://drupal.org/project/issues/search?text=jt
https://git7site.devdrupal.org/project/issues/search?text=jt
Comment | File | Size | Author |
---|---|---|---|
#12 | drupalorg-2118545-views-full-text-min-length.patch | 2.75 KB | Steven Jones |
Comments
Comment #1
tvn CreditAttribution: tvn commentedConfirmed.
Comment #2
tvn CreditAttribution: tvn commentedComment #3
tvn CreditAttribution: tvn commentedOur Search API server is configured properly, 'Minimum word length' to be indexed is 3.
Here is a similar issue in the Search API queue: #1961120: Searching for a word shorter than minimum word length returns all results
Comment #4
tvn CreditAttribution: tvn commented#1961120: Searching for a word shorter than minimum word length returns all results now has the patch, we can either apply it now or post-launch.
Comment #5
drummComment #6
tvn CreditAttribution: tvn commentedPatch is now committed to Search API.
Comment #7
tvn CreditAttribution: tvn commentedComment #8
drummSearch API with that patch has been deployed for weeks.
The code has
Which makes it seem like the message, and rest of validation, isn't done if min_length is 2 or greater.
Comment #9
tvn CreditAttribution: tvn commentedComment #10
drunken monkeyYou mean, less than 2? Or I don't understand the sentence.
In any case, the patch works fine for me locally, and I can't see anything that might immediately go wrong with it. However, this is of course Views, so it's always possible that
exposed_validate()
will not be called in some situations, or will be called with unexpected parameters, or other such things. I'd suggest to either reproduce the problem in a clean install, or debug what goes wrong in theexposed_validate()
call in your case.I know I probably don't have to ask the question, but did you set the "Minimum keyword length" setting in the filter correctly? Other than that, I wouldn't know what could go wrong (except the word splitting in edge cases).
Comment #11
tvn CreditAttribution: tvn commentedApparently you have to :) I just checked on my dev site and the issue queue search views have no minimum keyword length set at all. I set it to 3 and all works fine. No idea how they lost this setting though, I am pretty sure it was all fine when we tested this issue originally.
I'll re-export the views. Sorry for trouble!
Comment #12
Steven Jones CreditAttribution: Steven Jones commentedChanged the features on a dev site, see:
https://sprint5-drupal.redesign.devdrupal.org/project/issues/search?text=jt
Exported to code, and patch created.
Comment #13
Steven Jones CreditAttribution: Steven Jones commentedI added the min length option to all full-text search filters on all search API views.
Comment #14
tvn CreditAttribution: tvn commentedComment #16
drummComment #17
drummNow deployed.