Perlfect Solutions
 

[Perlfect-search] BUG: search terms smaller than minimum word length cause search to return no results

Jason Bodnar perlfect-search@perlfect.com
Sat, 14 Dec 2002 21:41:13 -0600
I had the minimum word length set to the default -- 3. If I searched for the
term "Dr. Bill" (no quotes) with match all I got no results. The term "Dr" was
not being found because it's not indexed due to being only two characters. If
I changed the min word length to 2 and reindexed then "Dr. Bill" returned results.

I think the search script should skip terms shorter than the minimum word
length. In search.pl, in the create_query sub, the line:

my @terms = split " ", $query_str;

should be changed to something like:

my @terms = grep($_ if length $_ >= $MIN_WORD_LENGTH, split " ", $query_str);

replacing $MIN_WORD_LENGTH with the variable that actually holds the min word
length from the conf.pl file.

--
Jason Bodnar
jason@shakabuku.org
http://www.shakabuku.org