views:

676

answers:

2

I have understood how to add xml files to SOLR and be able to search them via the SOLR ADMIN interface...

I need to know however, how to make SOLR work with PHP, and index MYSQL records...

This is what I want to do: I have a mysql table, which I would like to add to SOLR (index it), so that instead of searching the MYSQL table directly via PHP, I first take the querystring, send it to SOLR, and then SOLR sends back results in form of ID:nrs, then use the ID:s to query mysql and fetch proper records...

I have no clue on how to communicate with SOLR using PHP, any help is appreciated!

Thanks

+1  A: 

There's a good article here that will help you through the integration of PHP and SOLR:

http://www.ibm.com/developerworks/opensource/library/os-php-apachesolr/

There's a number of PHP interfaces to SOLR, that article references PHP SOLR client:

http://code.google.com/p/solr-php-client/

but there's also this:

http://pecl.php.net/package/solr

Jon
A: 

I'd suggest that you start with using DataImportHandler (http://wiki.apache.org/solr/DataImportHandler) for indexing the database and use one of the many Solr PHP clients (see SolrPHP wiki page). Note that Solr also emits JSON responses so if you are familiar with JSON, it may be the easiest way to get started.

Shalin