Search code examples
phpmysqlfull-text-searchsearch-engine

Advice on searching with PHP and MySQL


Basically, I got the same problem as this guy but I also need relevancy: PHP 'smart' search engine to search Mysql tables advice

But, I can't use Sphinx or Lucene (shared hosting)...

I can use LIKE but that has not relevancy so does anyone know a good PHP class that does create relevancy?

So I need something that fits this bill:

  • Result relevancy value
  • Match part of words, i.e. "LIKE %searchterm%"
  • Search multiple database columns
  • Can't use things like Sphinx or Lucene, no supported by my shared hosting...

I'm using the CakePHP framework.


Solution

  • I ended up using mysql's full-text search in boolean mode. I also append the * operators to each search term.

    user input: tom jones

    resulting query: match(name,description) against('tom* jones* IN BOOLEAN MODE');

    Thanks for everyone's help.