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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tvn’s picture

Status: Active » Needs review

Confirmed.

tvn’s picture

Priority: Normal » Major
Issue tags: +Drupal.org 7.1
tvn’s picture

Status: Needs review » Active

Our 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

tvn’s picture

Status: Active » Needs review

#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.

drumm’s picture

Priority: Major » Normal
tvn’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Patch is now committed to Search API.

tvn’s picture

Issue tags: +needs drupal.org deployment
drumm’s picture

Status: Reviewed & tested by the community » Active
Issue tags: -needs drupal.org deployment

Search API with that patch has been deployed for weeks.

The code has

    // We only need to validate if there is a minimum word length set.
    if ($this->options['min_length'] < 2) {
      return;
    }

Which makes it seem like the message, and rest of validation, isn't done if min_length is 2 or greater.

tvn’s picture

Project: [Archive] Drupal.org D7 upgrade QA » Drupal.org customizations
Version: » 7.x-3.x-dev
drunken monkey’s picture

Which makes it seem like the message, and rest of validation, isn't done if min_length is 2 or greater.

You 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 the exposed_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).

tvn’s picture

I know I probably don't have to ask the question, but did you set the "Minimum keyword length" setting in the filter correctly?

Apparently 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!

Steven Jones’s picture

Status: Active » Needs review
FileSize
2.75 KB

Changed the features on a dev site, see:

https://sprint5-drupal.redesign.devdrupal.org/project/issues/search?text=jt

Exported to code, and patch created.

Steven Jones’s picture

I added the min length option to all full-text search filters on all search API views.

tvn’s picture

  • Commit 43044ce on 7.x-3.x by drumm:
    #2118545 /project/issue/search returns results on two-character results
    
drumm’s picture

Status: Needs review » Fixed
Issue tags: +needs drupal.org deployment
drumm’s picture

Issue tags: -needs drupal.org deployment

Now deployed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.