You are here:  » Tweaking search query


Tweaking search query

Submitted by netsprite on Sat, 2006-04-01 16:46 in

Hi

Is it possible to tweak the search query slightly?

For example for a search on "hold ups" the current query will return all instances of "hold" within a product name - I'd like it to only return products which include the search term - or at least have the option for this...

Any suggestions welcome...

Cheers

Submitted by support on Sat, 2006-04-01 17:20

This is one of the limitations of the full text search method; in that your example query is broken down into 2 words; 1 of which is 4 characters long, and one which is 3; and by default 3 letter words are excluded from the full text search method.

In the code; if the query string is greater than 4 characters long the full text search method is used; so the word "ups" is not considered at all.

It is easy to make the code use the normal search method for all queries. In search.php; look for:

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

If you change that to:

  default:
    if (0)

.. that will disable the full text search, and the original "if includes, disregarding white space" method will be used.

Hope this helps...!

Cheers,
David.