开发者

SOLR and PHP help needed

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 tha开发者_运维问答t 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


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


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.


I've been there too and it was the first time I found the Internet to be annoying! Maybe that was because I was in such a hurry to learn it in under a minute. Here's what i suggest:

  • 1. Don't panic. Understanding the working or even just the implementation takes more than just a few seconds. So, keep some time aside for this.

  • 2. Learn how to use JSON. You can use this to communicate across languages.

  • 3. Check the apache site

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜