eroticheretic Posted October 4, 2006 Share Posted October 4, 2006 Hello all,I've been struggling a lot to write a good relevant search algorithm in php&mysql. our search basically deals with keywords.I'm using a full search technique using match against in mysql query.but thats giving some strage results.say i'm searching for "free online degree"its giving results for "free online degree","free online phones","free online games".......so on for all the keywords starting with "free online"Also I want to distinguish b/w singular and plural....ie if anyone searches for "house" ...the search should also include for "houses"...and vice versaI've checked the soundex function..but its not working our for me.If i say "select * from <tab name> where soundex(keyword)=soundex('phones')" its returning"pen inks","piano music","pop music".....which are no where related to my keyword "phones"all these keywords have the same soundex value.please help me out.Thanks,Sagar Quote Link to comment Share on other sites More sharing options...
printf Posted October 4, 2006 Share Posted October 4, 2006 Please show some code. soundex is linguistic matching anagram, not a search anagram. FULL TEXT uses word boundaries, [b]dog[/b] is never the same as [b]dogs[/b], you have to build that logic into your search logic by using the special operators '+house+(>s)' that tell the database what exactly you want it to do. Seeing your code will help me or other see if everything is right for what you want to do! What I normally do for plural / singular, is have a word list of words that could have a plural representation. Then I use that list to include them in the search, but also maintain a word boundary, in other words, get exact matches of plural / singular words. You do it that way so you only key on proper, real words that contain plural representation.Please understand a database gives you the tools to search effectively, but it does not automatically provide the logic, only you can create a set of sound logical rules that the database will follow. So what I am simply saying is any good search engine needs helper functions that build crafty queries that your database will follow!me! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.