Perform the following steps for generating a Lucene index:
Create a new search controller,
CommunicationApp/module/Users/src/Users/Controller/SearchController.php
, which will be used for searching and generating indexes.Add references to
ZendSearch\Lucene
:use ZendSearch\Lucene; use ZendSearch\Lucene\Document; use ZendSearch\Lucene\Index;
Add a method to fetch the index location from the module configuration:
public function getIndexLocation() { // Fetch Configuration from Module Config $config = $this->getServiceLocator()->get('config'); if ($config instanceof Traversable) { $config = ArrayUtils::iteratorToArray($config); } if (!empty($config['module_config']['search_index'])) { return $config['module_config']['search_index']; } else { return FALSE; } }
The index document needs to be generated in the following format: