Jump to content

Archived

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

eroticheretic

search algorithm issues with php&mysql

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

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

×

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.