François Schiettecatte’s Blog

Sphinx full text indexing with MySQL

Posted in Search by François Schiettecatte on August 1, 2007

IBM DeveloperWorks has a good primer article on Sphinx, a full text search engine which integrates with MySQL.

I read the documentation on Sphinx a few weeks ago and it appears to be a reasonably good search engine, though I have not tested it yet.

There was one thing in the article that caught my attention. While the author says that Lucene does not have a PHP API, Solr which front-ends Lucene has a number of output options, one of which is specific to PHP.

Lucene itself requires a fair amount of work to get going since it is a toolkit, Solr provides a very flexible front-end to it making it easy to create new indices, add and delete documents, and provides a powerful search interface. There is no integration with MySQL as such, but it would be pretty easy to write an extractor to pull data out of a MySQL database, convert the data to XML (which is what Solr expects) and pipe that data into Solr. I did that for MySQL dump files and it took me about 30 minutes write, debug and document it.

4 Responses

Subscribe to comments with RSS.

  1. jerk (tschitschereengreen) said, on August 30, 2007 at 6:52 am

    Hi, we just integrated Sphinx in an Symfony-PHP project and the provided API as well as the deamon and the installation docs are very extensiv. The whole duration for the integration was 4h. So I can just recommend all PHP coders to use Sphinx search for full text indexing and searching.

  2. Martin Streicher said, on November 10, 2007 at 10:31 am

    developerWorks is publishing a new PHP article of mine that shows how to combine Solr with PHP. The article should be available in Jan or Feb.

  3. salmanelahi said, on May 28, 2009 at 10:41 am

    Hi François,

    You mentioned that you have code to convert mysql dump into xml… can you please share that?

    Cheers,

    Salman

  4. salmanelahi said, on May 28, 2009 at 10:48 am

    Hi François,

    I figured it out… thanks anyways!


Leave a Reply

You must be logged in to post a comment.