Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: bitmovel on October 01, 2008, 04:20:44 AM

Title: Minimum search length
Post by: bitmovel on October 01, 2008, 04:20:44 AM
Hi

How can I set Minimum search length to 1 character?

Best Regards
Title: Re: Minimum search length
Post by: bitmovel on October 02, 2008, 03:52:31 PM
Quote from: bitmovel on October 01, 2008, 04:20:44 AM
Hi

How can I set Minimum search length to 1 character?

Best Regards


thank you for all the replies. :)

here is the solution, on Sources/Search.php

/* elseif (strlen($value) < 2)
{
$context['search_errors']['search_string_small_words'] = true;
unset($searchArray[$index]);
}*/
Title: Re: Minimum search length
Post by: H on October 02, 2008, 04:35:16 PM
I have to wonder what your reason for doing this is :). I can't see it being good for search performance either.

Anyone else who wants to did this will also need to make sure that they either don't use the fulltext search option or that the fulltext minimum character setting in MySQL is also set to 1.
Title: Re: Minimum search length
Post by: bitmovel on October 04, 2008, 08:48:45 AM
I have a movie related forum

a search example was:

'how i met your mother'

the search returned a error, since it could not search the word 'I'

This had to be done ;)
Title: Re: Minimum search length
Post by: H on October 04, 2008, 11:50:46 AM
Which search method are you using? :)
Title: Re: Minimum search length
Post by: bitmovel on October 04, 2008, 03:30:55 PM
at the moment I am using Fulltext index in SMF 2.0 b3

this worked for me. should I have done something else?

Title: Re: Minimum search length
Post by: Rumbaar on October 20, 2008, 04:55:37 AM
Yeah just search for "how met your mother", it will ignore the single characters and return the same results as well.  Also reduce load on the server for finding each and every 'i' in a post.