Searching the index is relatively simple using ZendSearch\Lucene
. The index needs to be opened for querying and the query string needs to be passed to the find()
method in ZendSearch\Lucene\Index
. The find
methods return an array matching the hits for the specific query, and this in turn can be used to render the search results.
There are two options for querying the index—you can pass the plain text query string to the find function or you can build your own Query
object using ZendSearch\Lucene\Search\Query
.
Tip
To read more about various query options in ZendSearch\Lucene, check the following developer documentation:
https://zf2.readthedocs.org/en/release-2.2.0/modules/zendsearch.lucene.queries.html
In the following example, we will be using plain text queries, and you can manipulate the search results by using operators such as :
,+
,-
, and field searches. For example, see the following list:
A search for all documents uploaded by Anne could be retrieved by the following query:
owner...