You are here:  » Effective searching


Effective searching

Submitted by nate on Sun, 2006-10-29 13:16 in

Afternoon,

I'm finding that when using the search function in PT, the it will only search return the first found words in the string.

Ie. If the search string is Corsair 1GB, it will return all products that have Corsair in the title and not necessarily in the most relevant order neither.

That search string on my site returns a CORSAIR NAUTILUS 500 CPU WATER COOLER KIT and other Corsair products (which do not have 1GB in the product name or description) before a Corsair Value Select 1Gb DDR2 PC4200 VS1GB533D2

Is there any way to make the search results more relevent?

Submitted by support on Sun, 2006-10-29 18:20

Hello nate,

What you have recognised is the trade-off that is a result of using MySQLs Full Text indexing. Because of performance constraints, a full text index by default ignores all words of less than 4 characters; which is why in this example 1GB is being ignored and the search is only being performed on "Corsair". If you just search for 1GB on its own, Price Tapestry defaults to a basic string search and will only return products with 1GB in the name.

For the majority of cases, the full text tradeoff is worth it; as it will return products even if the searcher is not sure of the spelling, or if, for example, they format a product or model number incorrectly.

It is possible to configure MySQL to build a Full Text index on words of > 2 characters (> 3 is the default). Some PT users have done this. How easy it is to do depends on your MySQL version and configuration - and how much control you have over this - although your host may be willing to help. Some versions require a re-compilation, whereas more recent versions just require a config change and restart. If you go down this route; having made the changes all feeds must be re-imported (in order to rebuild the index) and then a change made to search.php on line 63, currently:

if (strlen($parts[0]) > 3)

...change this to:

if (strlen($parts[0]) > 2)

Hope this helps!
Cheers,
David.

Submitted by nate on Mon, 2006-10-30 16:56

Thanks again David,

Luckily we run our own servers so we can make these changes.

Cheers,

Nate