Reputation:
I have a site that lists movies. Naturally people make spelling mistakes when searching for movies, and of course there is the fact that some movies have apostrophes, use letters to spell out numbers in the title, etc.
How do I get my search script to overlook these errors? Probably need something that's a little more intelligent than WHERE mov_title LIKE '%keyword%'
.
It was suggested that I use a fulltext search engine, but all of those things look really complicated, and I feel that building them into my application will be like hell on earth. If I do have to use one, what's the least invasive one, that will be most painless to implement into existing code?
Upvotes: 7
Views: 4631
Reputation: 117343
Presuming that you use MySQL - MySQL has no in-built functionality that is capable of doing this.
This means you will have to implement a full-text search yourself, or use a third party full text search tool.
Upvotes: 1
Reputation: 3781
I've used neither php nor mysql, but an alternative to full text search might be soundex searches.
Upvotes: 0
Reputation: 45721
I think you'll have to implement an external fulltext search engine. MySQL just isn't good at fulltext search. I'd say you should give Lucene a go (tutorials). Zend Framework has an API that plugs into Lucene, making it easier to learn and utilize.
Upvotes: 6