Hi,
I've run into another snag, I would like to be able to search for 2 and 3 letter words (example LDV TV, Blu Ray DVD etc....) but Price tapestry seems to exclude any search work below 4 letters - can this be changed?
Thanks in advance
Steve
Hi David,
That is perfect!!! Like you say it's not ideal but I think in my case it will work just fine - searching for LCD TV now brings back 117 results rather than 0 so that's an infinate amount more :o)
Thanks again for the quick responce!
Hi Steve,
This is a bit of a "gotcha" situation i'm afraid, as by default, MySQL does not include words less than 4 characters long in the full text index. The script defaults to a basic search method if the query is less than 4 characters, but the situation here is that the total query length for the example "LCD TV" is greater than 4 characters, but neither word itself is....
It would be possible to make a simple modification to handle this situation, but the only caveat would be that the words would have to be in the same placement in the products, so "LCD TV" would match "Sony LCD TV" but not "Sony LCD 24 inch TV".
To make this change, look for the following code in search.php (line 63 in the distribution):
if (strlen($parts[0]) > 3)
...and replace that with the following block of code:
$useFullText = FALSE;
$words = explode(" ",$parts[0]);
foreach($words as $word)
{
if (strlen($word) >= 4)
{
$useFullText = TRUE;
}
}
// if not using full text index, spaces must be removed from the query
if (!$useFullText) $parts[0] = str_replace(" ","",$parts[0]);
// the following line replaces the deleted line from the original code
if ($useFullText)
Hope this helps give better results...
Cheers,
David.