Lucene with PHP

Lucene with PHP

I would recommend using Apache SOLR as your Lucene backend and connecting via web service calls from your PHP code.

I'd also note that it's easy to pick and choose components of Zend Framework for use in your application without loading the entire framework. You could use Zend_Search_Lucene in your site and forego Zend's MVC, database, and related components.

Use Lucene in PHP

Solr has a REST API which could be used from PHP, or any language for that matter.

Zend lucene and MySql database

I would investigate if MySQLs native Full-Text Searching would meet your needs first before jumping to a Lucene based solution. It is a major improvement upon using LIKE statements without the additional implementation required for Lucene.

Zend_Search_Lucene is a pure PHP implementation of Lucene and can therefore be pretty slow when used with large datasets. I would skip it and look at implementing Apache Solr. There is PECL extension for it, which is documented here.

php fatal error, require once

You have to add your Zend Library to include path.

If your Zend Framework is in G:\xampp\htdocs\includes\Zend, then you have to include it so:

<?php
$path = 'G:\xampp\htdocs\includes\Zend';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

Also you should give absolute path for Lucene data. For example:

$index = Zend_Search_Lucene::create('/var/searchindex/LuceneData/');

The folder /var/searchindex/LuceneData/ should exist and be writable.

Indexing large DB's with Lucene/PHP

I'm sorry to say it, because the developer of Zend_Search_Lucene is a friend and he has worked really hard it, but unfortunately it's not suitable to create indexes on data sets of any nontrivial size.

Use Apache Solr to create indexes. I have tested that Solr runs more than 300x faster than Zend for creating indexes.

You could use Zend_Search_Lucene to issue queries against the index you created with Apache Solr.

Of course you could also use the PHP PECL Solr extension, which I would recommend.



Related Topics



Leave a reply



Submit