MySQL Forums
Forum List  »  Newbie

Re: broad match search results, splitting the search by spaces
Posted by: Joseph Charles
Date: November 12, 2014 04:18AM

Hi Rick James,
thank you for the reply. The search form on the website is for specific product sizes, so there will not be any issue of people wanting to search for approximate sizes. If they are using the search, then they know exactly what size they require.

The only problem is the different format that they may enter the details in:

For example they could search for:

38mm x 21mm
or
38
or
38mm
or
38 mm
or
38 x 21
or
21mm x 38mm
or
21 x 38

all these should match the same product, but currently the only ones that will work using LIKE are the first 3.


I do have a few questions about FULLTEXT that I didnt quite understand from th code that was suggested by Peter:

set @rsCustSearch__testvar='abc 38mm x 21';
set @match = concat("%", @rscustsearch__testvar, "%" );
select *
from products
where match( productname, llength, lheight) against( @match in natural language mode );


Where it says: set @rsCustSearch__testvar='abc 38mm x 21';
does that change what the person has searched for to "abc 38mm x 21" or does it just set that as the standard that might be searched for? Im a little confused as I have never used this sort of code before. (ive only ever used = or LIKE)

Will that code break up the search in to separate parts to match?
Joseph

Options: ReplyQuote


Subject
Written By
Posted
Re: broad match search results, splitting the search by spaces
November 12, 2014 04:18AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.