You are here:  » Which field for searching?

Support Forum



Which field for searching?

Submitted by maxbear on Wed, 2009-04-08 19:47 in

Hello,

I found there are 2 fields in the db.

1. name
2. search_name

The search_name is actually the name field but without space between words. So which field is for searching? Thanks.

Max

Submitted by support on Wed, 2009-04-08 19:58

Hi,

There are 2 search methods used by the script. If all words in the query contain more than 4 letters the Full Text index is used (MySQL's Full Text index does not include words less than that length); otherwise a basic LIKE query is used.

The full text index is built against the "name" field (the same field that is displayed throughout the script), whereas the basic search method uses the search_name field, so that any spaces entered by the user are not counted.

It helps to exclude spaces, because a product might have a common model number, say "ABC 123", but many people would search for this as ABC123 - so by excluding spaces both versions would return the desired result.

If you want to see how this is worked out in the code, look in search.php around about lines 63 - 102...

Cheers,
David.