Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Search not returning results with "LIKE" correctly


Guest

Recommended Posts

Please help. I've having trouble with the seach function.

 

Here's my page: (Try searching both with 'Jacket' and 'Jackets')

 

http://www.kohalaplantation.com/order/adva...keywords=jacket

 

If you search on 'jacket,' you get results, if you search on 'jackets', nothing is returned.

 

I've looked at the code and it appears that it's being queried using "LIKE", so why isn't it return for close matches?? It's being too literal.

 

Anyone have any ideas or suggestions? :'(

Link to comment
Share on other sites

"LIKE" in the context of SQL does not mean "close match" at all - it is just a string matching tool.

eg LIKE 'BOAT%' would match strings beginning with "BOAT" OR "BOATS"

 

LIKE 'BOATS%' would _not_ match anything beginning "BOAT"

 

To do anything more sophisticated would involve soundex values and other stuff - not really worth the hassle.

Link to comment
Share on other sites

"LIKE" in the context of SQL does not mean "close match" at all - it is just a string matching tool.

eg LIKE 'BOAT%' would match strings beginning with "BOAT" OR "BOATS"

 

LIKE 'BOATS%' would _not_ match anything  beginning "BOAT"

 

To do anything more sophisticated would involve soundex values and other stuff - not really worth the hassle.

 

All there needs to be is a loop statement to take the whole word and start dropping characters off from the end each loop. Then it will hit on every match from the "J" to "Jackets". On exact match, stop the loop.

 

The problem is finding someone to code it. Good Luck.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...