Jump to content

search algorithm issues with php&mysql


eroticheretic

Recommended Posts

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
Link to comment
Share on other sites

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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.