PDA

View Full Version : Site Search


hairsoup
11th December 2005, 10:51
... one for the nerdlingers here!

Does anyone know how to do a really good site search. Currently I'm using mysql MATCH() AGAINST(), which sorts my results by relevancy, but its still pretty crud, as it wont search three letter words, and still have to get the spelling spot on. Any suggestions? Ive looked at things like SOUNDEX() which looks like it might be of some use but after reading the manual i cant see how i would apply it?

If anyone can point me to where I can educate myself on this that would be great.

Coding Monkey
11th December 2005, 10:54
Levenshtein (http://uk2.php.net/manual/en/function.levenshtein.php) in PHP or Full Text Search (http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html) using MySQL

Edit: Oh, what version of MySQL do you have?

I should also add that the Full Text Search, which you're using, is better enhanced using regex. Can you show me the exact code?

hairsoup
11th December 2005, 10:58
thanks for quick reply mate.

im on 4.1.11, that levenshtein looks nifty but too bad im on ASP!

your mysql link goes to the same place i found out about MATCH AGAINST.

Richard Conyard
11th December 2005, 11:00
mondo search?

Or you could go all out and get a google box ;-)

Coding Monkey
11th December 2005, 11:01
I'm surprised you have issues with Full Text Search. What happens Have you tried LIKE or REGEXP?

hairsoup
11th December 2005, 11:09
Ive done LIKE then changed to MATCH AGAINST for the ability to sort by relevancy.

Coding Monkey
11th December 2005, 11:15
Can you give me an example? Is it incorrectly spelt words you're searching for then? I'm afraid I'm not an ASP man, but here's some MySQL knowledge that might help out. I'm not too sure.

For example, you can do something like: +tom cahalan

which means 'tom' is required and cahalan is optional

You could also do: tom* cahalan* which would match toms cahalans

hairsoup
11th December 2005, 11:55
thanks, but isnt mysqls wildcard character % not * ?

Coding Monkey
11th December 2005, 11:56
Only in LIKE. MATCH AGAINST and REGEXP allow those characters.