Proxy class intended to be used in userland.

It tracks, when index object goes out of scope and forces ndex closing

category Zend
package Zend_Search_Lucene
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Object constructor

__construct(\Zend_Search_Lucene_Interface $index) 

Parameters

$index

\Zend_Search_Lucene_Interface

Object destructor

__destruct() 

Adds a document to this index.

addDocument(\Zend_Search_Lucene_Document $document) 
inherited_from \Zend_Search_Lucene_Interface::addDocument()

Parameters

$document

\Zend_Search_Lucene_Document

Close terms stream

closeTermsStream() 

Should be used for resources clean up if stream is not read up to the end

Commit changes resulting from delete() or undeleteAll() operations.

commit() 
inherited_from \Zend_Search_Lucene_Interface::commit()

Returns the total number of documents in this index (including deleted documents).

count() : integer
inherited_from \Zend_Search_Lucene_Interface::count()

Returns

integer

Returns term in current position

currentTerm() : \Zend_Search_Lucene_Index_Term | null

Returns

\Zend_Search_Lucene_Index_Termnull

Deletes a document from the index.

delete(integer|\Zend_Search_Lucene_Search_QueryHit $id) 

$id is an internal document id

inherited_from \Zend_Search_Lucene_Interface::delete()

Parameters

$id

integer\Zend_Search_Lucene_Search_QueryHit

Exceptions

\Zend_Search_Lucene_Exception

Returns the number of documents in this index containing the $term.

docFreq(\Zend_Search_Lucene_Index_Term $term) : integer
inherited_from \Zend_Search_Lucene_Interface::docFreq()

Parameters

$term

\Zend_Search_Lucene_Index_Term

Returns

integer

Performs a query against the index and returns an array of Zend_Search_Lucene_Search_QueryHit objects.

find(mixed $query) : array

Input is a string or Zend_Search_Lucene_Search_Query.

inherited_from \Zend_Search_Lucene_Interface::find()

Parameters

$query

mixed

Exceptions

\Zend_Search_Lucene_Exception

Returns

arrayZend_Search_Lucene_Search_QueryHit

Get current generation number

getActualGeneration(\Zend_Search_Lucene_Storage_Directory $directory) : integer
Static

Returns generation number 0 means pre-2.1 index format -1 means there are no segments files.

inherited_from \Zend_Search_Lucene_Interface::getActualGeneration()

Parameters

$directory

\Zend_Search_Lucene_Storage_Directory

Exceptions

\Zend_Search_Lucene_Exception

Returns

integer

Get default search field.

getDefaultSearchField() : string
Static

Null means, that search is performed through all fields by default

inherited_from \Zend_Search_Lucene_Interface::getDefaultSearchField()

Returns

string

Returns the Zend_Search_Lucene_Storage_Directory instance for this index.

getDirectory() : \Zend_Search_Lucene_Storage_Directory
inherited_from \Zend_Search_Lucene_Interface::getDirectory()

Returns

\Zend_Search_Lucene_Storage_Directory

Returns a Zend_Search_Lucene_Document object for the document number $id in this index.

getDocument(integer|\Zend_Search_Lucene_Search_QueryHit $id) : \Zend_Search_Lucene_Document
inherited_from \Zend_Search_Lucene_Interface::getDocument()

Parameters

$id

integer\Zend_Search_Lucene_Search_QueryHit

Returns

\Zend_Search_Lucene_Document

Returns a list of all unique field names that exist in this index.

getFieldNames(boolean $indexed = false) : array
inherited_from \Zend_Search_Lucene_Interface::getFieldNames()

Parameters

$indexed

boolean

Returns

array

Get index format version

getFormatVersion() : integer
inherited_from \Zend_Search_Lucene_Interface::getFormatVersion()

Returns

integer

Retrieve index maxBufferedDocs option

getMaxBufferedDocs() : integer

maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment

Default value is 10

inherited_from \Zend_Search_Lucene_Interface::getMaxBufferedDocs()

Returns

integer

Retrieve index maxMergeDocs option

getMaxMergeDocs() : integer

maxMergeDocs is a largest number of documents ever merged by addDocument(). Small values (e.g., less than 10,000) are best for interactive indexing, as this limits the length of pauses while indexing to a few seconds. Larger values are best for batched indexing and speedier searches.

Default value is PHP_INT_MAX

inherited_from \Zend_Search_Lucene_Interface::getMaxMergeDocs()

Returns

integer

Retrieve index mergeFactor option

getMergeFactor() : integer

mergeFactor determines how often segment indices are merged by addDocument(). With smaller values, less RAM is used while indexing, and searches on unoptimized indices are faster, but indexing speed is slower. With larger values, more RAM is used during indexing, and while searches on unoptimized indices are slower, indexing is faster. Thus larger values (> 10) are best for batch index creation, and smaller values (< 10) for indices that are interactively maintained.

Default value is 10

inherited_from \Zend_Search_Lucene_Interface::getMergeFactor()

Returns

integer

Set result set limit.

getResultSetLimit() : integer
Static

0 means no limit

inherited_from \Zend_Search_Lucene_Interface::getResultSetLimit()

Returns

integer

Get segments file name

getSegmentFileName(integer $generation) : string
Static
inherited_from \Zend_Search_Lucene_Interface::getSegmentFileName()

Parameters

$generation

integer

Returns

string

Retrive similarity used by index reader

getSimilarity() : \Zend_Search_Lucene_Search_Similarity
inherited_from \Zend_Search_Lucene_Interface::getSimilarity()

Returns

\Zend_Search_Lucene_Search_Similarity

Returns true if any documents have been deleted from this index.

hasDeletions() : boolean
inherited_from \Zend_Search_Lucene_Interface::hasDeletions()

Returns

boolean

Returns true if index contain documents with specified term.

hasTerm(\Zend_Search_Lucene_Index_Term $term) : boolean

Is used for query optimization.

inherited_from \Zend_Search_Lucene_Interface::hasTerm()

Parameters

$term

\Zend_Search_Lucene_Index_Term

Returns

boolean

Checks, that document is deleted

isDeleted(integer $id) : boolean
inherited_from \Zend_Search_Lucene_Interface::isDeleted()

Parameters

$id

integer

Exceptions

\Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range

Returns

boolean

Returns one greater than the largest possible document number.

maxDoc() : integer

This may be used to, e.g., determine how big to allocate a structure which will have an element for every document number in an index.

inherited_from \Zend_Search_Lucene_Interface::maxDoc()

Returns

integer

Scans terms dictionary and returns next term

nextTerm() : \Zend_Search_Lucene_Index_Term | null

Returns

\Zend_Search_Lucene_Index_Termnull

Returns a normalization factor for "field, document" pair.

norm(integer $id, string $fieldName) : float
inherited_from \Zend_Search_Lucene_Interface::norm()

Parameters

$id

integer

$fieldName

string

Returns

float

Returns the total number of non-deleted documents in this index.

numDocs() : integer
inherited_from \Zend_Search_Lucene_Interface::numDocs()

Returns

integer

Optimize index.

optimize() 

Merges all segments into one

inherited_from \Zend_Search_Lucene_Interface::optimize()

Reset terms stream.

resetTermsStream() 

Set default search field.

setDefaultSearchField(string $fieldName) 
Static

Null means, that search is performed through all fields by default

Default value is null

inherited_from \Zend_Search_Lucene_Interface::setDefaultSearchField()

Parameters

$fieldName

string

Set index format version.

setFormatVersion(integer $formatVersion) 

Index is converted to this format at the nearest upfdate time

inherited_from \Zend_Search_Lucene_Interface::setFormatVersion()

Parameters

$formatVersion

integer

Exceptions

\Zend_Search_Lucene_Exception

Set index maxBufferedDocs option

setMaxBufferedDocs(integer $maxBufferedDocs) 

maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment

Default value is 10

inherited_from \Zend_Search_Lucene_Interface::setMaxBufferedDocs()

Parameters

$maxBufferedDocs

integer

Set index maxMergeDocs option

setMaxMergeDocs(integer $maxMergeDocs) 

maxMergeDocs is a largest number of documents ever merged by addDocument(). Small values (e.g., less than 10,000) are best for interactive indexing, as this limits the length of pauses while indexing to a few seconds. Larger values are best for batched indexing and speedier searches.

Default value is PHP_INT_MAX

inherited_from \Zend_Search_Lucene_Interface::setMaxMergeDocs()

Parameters

$maxMergeDocs

integer

Set index mergeFactor option

setMergeFactor($mergeFactor) 

mergeFactor determines how often segment indices are merged by addDocument(). With smaller values, less RAM is used while indexing, and searches on unoptimized indices are faster, but indexing speed is slower. With larger values, more RAM is used during indexing, and while searches on unoptimized indices are slower, indexing is faster. Thus larger values (> 10) are best for batch index creation, and smaller values (< 10) for indices that are interactively maintained.

Default value is 10

inherited_from \Zend_Search_Lucene_Interface::setMergeFactor()

Parameters

$mergeFactor

Set result set limit.

setResultSetLimit(integer $limit) 
Static

0 (default) means no limit

inherited_from \Zend_Search_Lucene_Interface::setResultSetLimit()

Parameters

$limit

integer

Skip terms stream up to specified term preffix.

skipTo(\Zend_Search_Lucene_Index_Term $prefix) 

Prefix contains fully specified field info and portion of searched term

Parameters

$prefix

\Zend_Search_Lucene_Index_Term

Returns IDs of all the documents containing term.

termDocs(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter|null $docsFilter = null) : array
inherited_from \Zend_Search_Lucene_Interface::termDocs()

Parameters

$term

\Zend_Search_Lucene_Index_Term

$docsFilter

\Zend_Search_Lucene_Index_DocsFilternull

Returns

array

Returns documents filter for all documents containing term.

termDocsFilter(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter|null $docsFilter = null) : \Zend_Search_Lucene_Index_DocsFilter

It performs the same operation as termDocs, but return result as Zend_Search_Lucene_Index_DocsFilter object

inherited_from \Zend_Search_Lucene_Interface::termDocsFilter()

Parameters

$term

\Zend_Search_Lucene_Index_Term

$docsFilter

\Zend_Search_Lucene_Index_DocsFilternull

Returns

\Zend_Search_Lucene_Index_DocsFilter

Returns an array of all term freqs.

termFreqs(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter|null $docsFilter = null) : integer

Return array structure: array( docId => freq, ...)

inherited_from \Zend_Search_Lucene_Interface::termFreqs()

Parameters

$term

\Zend_Search_Lucene_Index_Term

$docsFilter

\Zend_Search_Lucene_Index_DocsFilternull

Returns

integer

Returns an array of all term positions in the documents.

termPositions(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter|null $docsFilter = null) : array

Return array structure: array( docId => array( pos1, pos2, ...), ...)

inherited_from \Zend_Search_Lucene_Interface::termPositions()

Parameters

$term

\Zend_Search_Lucene_Index_Term

$docsFilter

\Zend_Search_Lucene_Index_DocsFilternull

Returns

array

Returns an array of all terms in this index.

terms() : array
inherited_from \Zend_Search_Lucene_Interface::terms()

Returns

array

Undeletes all documents currently marked as deleted in this index.

undeleteAll() 
inherited_from \Zend_Search_Lucene_Interface::undeleteAll()

 Properties

 

Index object

$_index : \Zend_Search_Lucene_Interface

Default