Jump to content


Photo

search algorithm issues with php&mysql


  • Please log in to reply
1 reply to this topic

#1 eroticheretic

eroticheretic
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 04 October 2006 - 12:10 PM

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 versa

I'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


#2 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 04 October 2006 - 01:27 PM

Please show some code. soundex is linguistic matching anagram, not a search anagram. FULL TEXT uses word boundaries, dog is never the same as dogs, 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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users