Provide a way of setting a minimum length before a (ajax) search call is triggered... Patch extracted from #942632: Monster issue.

Required to be set to "3 characters" for "Drupal search" to avoid error messages.

Comments

danchadwick’s picture

Just noticed that "3" does not appear to be hard-coded in the search module, or at least the UI implies that if you visit /admin/settings/search.

+ $lower_limit = ($form_state['values']['uniqueness_search_mode'] == UNIQUENESS_SEARCH_MODE_DRUPAL) ? 3 : 1;

bforchhammer’s picture

StatusFileSize
new2.9 KB

You're right, it's not hard coded; it's stored in the 'minimum_word_size' variable... Attached patch uses that instead of '3'.

danchadwick’s picture

Status: Needs review » Needs work

Current minimum should be enforced not just at config time, but also at run time:

+    'minCharacters' => variable_get('uniqueness_query_min', 3),

Because the search limit could have been lowered after uniqueness was configured. minCharacters should be the lesser of the two variables.

bforchhammer’s picture

StatusFileSize
new3.45 KB

Here we go... (not very elegant, but it does the job).

bforchhammer’s picture

Status: Needs work » Needs review
bforchhammer’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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