Zend Framework 2 Search Lucene?

ZF1 implemented a lucene search implementation. is there something similar for zf2? I canโ€™t find anything ...

+7
source share
2 answers

This is part of ZendSearch and you will find it here https://github.com/zendframework/ZendSearch

If you go through the folders, you will find Lucene, but you will probably need to install all of this by following the instructions in the readme file on the first page that I linked to.

In addition, you can burn a CD to your supplierโ€™s directory and run: -

git clone https://github.com/zendframework/ZendSearch.git 

This will create the ZendSearch module, and you can add it to the list of modules in the application.config.php file

Also see the Zend Framework package repository .

+10
source

This is for Zend Framework 3 / Zend Search

The following code will help you get started with Zend Search:

 use ZendSearch\Lucene\Lucene; use ZendSearch\Lucene\Document; use ZendSearch\Lucene\Document\Field; use ZendSearch\Lucene\MultiSearcher; $index = Lucene::create($path_to_index); // or use open to update an index $document = new Document; $document->addField(Field::Text($key,$value)); $index->addDocument($document); $search = Lucene::open($path_to_index); $search->find($str); 

However, it is worth noting that at the time of writing, Zend Search expects ErrorHandler :: to be available, which is part of Stdlib of Zend. I believe this was removed from stdlib, so I just replaced these calls with a try / catch block.

In addition to the above example, the code in the ZF v1 manual provides a good basis for working in terms of functionality: https://framework.zend.com/manual/1.12/en/zend.search.lucene.overview.html .

+1
source

All Articles