If the user enters a single stop word into search-field (eg. the expression "wenig") and the minimum word size is set to any value >0, the user received the improper warning, that the entered search expression has to be longer than the min word size. This confuses quite much.
The following changes of de_stemmer.module eliminate these problem:
additional definition:
define('DE_STEMMER_DEFAULT_SEARCH_TEXT', 'aeueoeaeoeue');
modified function:
function de_stemmer_search_preprocess($text) {
...
// Put it all back together...but check, if min word size was under-run by elimination of stop words
$return = implode('', $words);
$min_word_size = intval(variable_get('minimum_word_size', 3));
if (drupal_strlen($return) < $min_word_size && drupal_strlen($text) >= $min_word_size ) {
return DE_STEMMER_DEFAULT_SEARCH_TEXT;
}
else {
return $return;
}
}
The DE_STEMMER_DEFAULT_SEARCH_TEXT should be a string, which is very improbable to exist as index search key.
Comments
Comment #1
schildi commentedOK, I knew about this behavior but didn't pay attention to it.
May be it is better to hide this from the user by implementing some kind of a dummy search word. I will check this. And I will also check for possible alternate solutions. May be there is a way to set this dummy search expression to a compilation of characters which can't be part of a search word - special characters or a tag.
Nice to see that someone is going more in details and has a look at the code.
Regards
Comment #2
schildi commentedComment #3
schildi commentedCurrently the search process of my sites are based on "search lucene". I hope it's behavior does not differ too much from ordinary core search.
An alternate way to the one you recommended seems to set a simple underscore in the case when only stop words are searched (function de_stemmer_search_preprocess):
This results in a normal "Die Suche lieferte keine Ergebnisse." when searching for stop words only.
I will give this a try and commit the change to head.
Comment #4
schildi commented