Sphinx full text indexing with MySQL

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.

About these ads

4 Responses to Sphinx full text indexing with MySQL

  1. 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 says:

    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 says:

    Hi François,

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

    Cheers,

    Salman

  4. salmanelahi says:

    Hi François,

    I figured it out… thanks anyways!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: