Indexing is a fairly straightforward process using ZendSearch\Lucene
. All we need is to create documents with fields and values, and keep adding the document to the index. You can also remove documents, update documents, and clear an index. The following classes are used in index generation:
Field
– TheZendSearch\Lucene\Document\Field
class allows users to define a new document field; this field can be classified into one the following types:Field::keyword($name, $value, $encoding = 'UTF-8')
: thekeyword
field type is used to identify string fields that don't have to be tokenized, yet need to be indexed and stored. For example, date and URL.Field::unIndexed($name, $value, $encoding = 'UTF-8')
: TheunIndexed
field type is used to store fields in the index without having to index/tokenize them. For example, ID fields.Field::binary($name, $value)
: Thebinary
field type is used for storing binary values in the index.Field::text($name, $value, $encoding = 'UTF-8')
: Thetext
field...