Search/Lucene/MultiSearcher.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Search_Lucene
- Version
- $Id: MultiSearcher.php 24862 2012-06-02 00:04:53Z adamlundrigan $
\Zend_Search_Lucene_Interface_MultiSearcher
This class is provided for backwards-compatibility (See ZF-12067)
- Parent(s)
- \Zend_Search_Lucene_MultiSearcher
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties


callback $_documentDistributorCallBack = null
Callback used to choose target index for new documents
Inherited from: \Zend_Search_Lucene_MultiSearcher::$$_documentDistributorCallBackFunction/method signature: Zend_Search_Lucene_Interface callbackFunction(Zend_Search_Lucene_Document $document, array $indices);
null means "default documents distributing algorithm"
null
Details- Type
- callback
- Inherited_from
- \Zend_Search_Lucene_MultiSearcher::$$_documentDistributorCallBack


array $_indices =
List of indices for searching.
Inherited from: \Zend_Search_Lucene_MultiSearcher::$$_indicesArray of Zend_Search_Lucene_Interface objects
- Type
- array
- Inherited_from
- \Zend_Search_Lucene_MultiSearcher::$$_indices


\Zend_Search_Lucene_TermStreamsPriorityQueue $_termsStream = null
Terms stream priority queue object
Inherited from: \Zend_Search_Lucene_MultiSearcher::$$_termsStreamnull
Details
Methods


__construct(array $indices = array()) : void
Name | Type | Description |
---|---|---|
$indices | array | Arrays of indices for search |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


addDocument(\Zend_Search_Lucene_Document $document) : void
Adds a document to this index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::addDocument()Name | Type | Description |
---|---|---|
$document | \Zend_Search_Lucene_Document |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


addIndex(\Zend_Search_Lucene_Interface $index) : void
Name | Type | Description |
---|---|---|
$index | \Zend_Search_Lucene_Interface |


commit() : void
Commit changes resulting from delete() or undeleteAll() operations.
Inherited from: \Zend_Search_Lucene_MultiSearcher::commit()

count() : integer
Returns the total number of documents in this index (including deleted documents).
Inherited from: \Zend_Search_Lucene_MultiSearcher::count()Type | Description |
---|---|
integer |


currentTerm() : \Zend_Search_Lucene_Index_Term | null
Returns term in current position
Inherited from: \Zend_Search_Lucene_MultiSearcher::currentTerm()Type | Description |
---|---|
\Zend_Search_Lucene_Index_Term | null |


delete(integer | \Zend_Search_Lucene_Search_QueryHit $id) : void
Deletes a document from the index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::delete()$id is an internal document id
Name | Type | Description |
---|---|---|
$id | integer | \Zend_Search_Lucene_Search_QueryHit |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


docFreq(\Zend_Search_Lucene_Index_Term $term) : integer
Returns the number of documents in this index containing the $term.
Inherited from: \Zend_Search_Lucene_MultiSearcher::docFreq()Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term |
Type | Description |
---|---|
integer |


find(mixed $query) : array
Performs a query against the index and returns an array of Zend_Search_Lucene_Search_QueryHit objects.
Inherited from: \Zend_Search_Lucene_MultiSearcher::find()Input is a string or Zend_Search_Lucene_Search_Query.
Name | Type | Description |
---|---|---|
$query | mixed |
Type | Description |
---|---|
array | Zend_Search_Lucene_Search_QueryHit |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getActualGeneration(\Zend_Search_Lucene_Storage_Directory $directory) : integer
Get current generation number
Inherited from: \Zend_Search_Lucene_MultiSearcher::getActualGeneration()Returns generation number 0 means pre-2.1 index format -1 means there are no segments files.
Name | Type | Description |
---|---|---|
$directory | \Zend_Search_Lucene_Storage_Directory |
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getDefaultSearchField() : string
Get default search field.
Inherited from: \Zend_Search_Lucene_MultiSearcher::getDefaultSearchField()Null means, that search is performed through all fields by default
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getDirectory() : \Zend_Search_Lucene_Storage_Directory
Returns the Zend_Search_Lucene_Storage_Directory instance for this index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::getDirectory()Type | Description |
---|---|
\Zend_Search_Lucene_Storage_Directory |


getDocument(integer | \Zend_Search_Lucene_Search_QueryHit $id) : \Zend_Search_Lucene_Document
Returns a Zend_Search_Lucene_Document object for the document number $id in this index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::getDocument()Name | Type | Description |
---|---|---|
$id | integer | \Zend_Search_Lucene_Search_QueryHit |
Type | Description |
---|---|
\Zend_Search_Lucene_Document |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception | Exception is thrown if $id is out of the range |


getDocumentDistributorCallback() : callback
Get callback for choosing target index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::getDocumentDistributorCallback()Type | Description |
---|---|
callback |


getFieldNames(boolean $indexed = false) : array
Returns a list of all unique field names that exist in this index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::getFieldNames()Name | Type | Description |
---|---|---|
$indexed | boolean |
Type | Description |
---|---|
array |


getFormatVersion() : integer
Get index format version
Inherited from: \Zend_Search_Lucene_MultiSearcher::getFormatVersion()Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getMaxBufferedDocs() : integer
Retrieve index maxBufferedDocs option
Inherited from: \Zend_Search_Lucene_MultiSearcher::getMaxBufferedDocs()maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment
Default value is 10
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getMaxMergeDocs() : integer
Retrieve index maxMergeDocs option
Inherited from: \Zend_Search_Lucene_MultiSearcher::getMaxMergeDocs()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
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getMergeFactor() : integer
Retrieve index mergeFactor option
Inherited from: \Zend_Search_Lucene_MultiSearcher::getMergeFactor()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
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getResultSetLimit() : integer
Set result set limit.
Inherited from: \Zend_Search_Lucene_MultiSearcher::getResultSetLimit()0 means no limit
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getSegmentFileName(integer $generation) : string
Get segments file name
Inherited from: \Zend_Search_Lucene_MultiSearcher::getSegmentFileName()Name | Type | Description |
---|---|---|
$generation | integer |
Type | Description |
---|---|
string |


getSimilarity() : \Zend_Search_Lucene_Search_Similarity
Retrive similarity used by index reader
Inherited from: \Zend_Search_Lucene_MultiSearcher::getSimilarity()Type | Description |
---|---|
\Zend_Search_Lucene_Search_Similarity |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


hasDeletions() : boolean
Returns true if any documents have been deleted from this index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::hasDeletions()Type | Description |
---|---|
boolean |


hasTerm(\Zend_Search_Lucene_Index_Term $term) : boolean
Returns true if index contain documents with specified term.
Inherited from: \Zend_Search_Lucene_MultiSearcher::hasTerm()Is used for query optimization.
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term |
Type | Description |
---|---|
boolean |


isDeleted(integer $id) : boolean
Checks, that document is deleted
Inherited from: \Zend_Search_Lucene_MultiSearcher::isDeleted()Name | Type | Description |
---|---|---|
$id | integer |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception | Exception is thrown if $id is out of the range |


maxDoc() : integer
Returns one greater than the largest possible document number.
Inherited from: \Zend_Search_Lucene_MultiSearcher::maxDoc()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.
Type | Description |
---|---|
integer |


nextTerm() : \Zend_Search_Lucene_Index_Term | null
Scans terms dictionary and returns next term
Inherited from: \Zend_Search_Lucene_MultiSearcher::nextTerm()Type | Description |
---|---|
\Zend_Search_Lucene_Index_Term | null |


norm(integer $id, string $fieldName) : float
Returns a normalization factor for "field, document" pair.
Inherited from: \Zend_Search_Lucene_MultiSearcher::norm()Name | Type | Description |
---|---|---|
$id | integer | |
$fieldName | string |
Type | Description |
---|---|
float |


numDocs() : integer
Returns the total number of non-deleted documents in this index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::numDocs()Type | Description |
---|---|
integer |


setDefaultSearchField(string $fieldName) : void
Set default search field.
Inherited from: \Zend_Search_Lucene_MultiSearcher::setDefaultSearchField()Null means, that search is performed through all fields by default
Default value is null
Name | Type | Description |
---|---|---|
$fieldName | string |


setDocumentDistributorCallback(callback $callback) : void
Set callback for choosing target index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::setDocumentDistributorCallback()Name | Type | Description |
---|---|---|
$callback | callback |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


setFormatVersion(int $formatVersion) : void
Set index format version.
Inherited from: \Zend_Search_Lucene_MultiSearcher::setFormatVersion()Index is converted to this format at the nearest upfdate time
Name | Type | Description |
---|---|---|
$formatVersion | int |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


setMaxBufferedDocs(integer $maxBufferedDocs) : void
Set index maxBufferedDocs option
Inherited from: \Zend_Search_Lucene_MultiSearcher::setMaxBufferedDocs()maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment
Default value is 10
Name | Type | Description |
---|---|---|
$maxBufferedDocs | integer |


setMaxMergeDocs(integer $maxMergeDocs) : void
Set index maxMergeDocs option
Inherited from: \Zend_Search_Lucene_MultiSearcher::setMaxMergeDocs()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
Name | Type | Description |
---|---|---|
$maxMergeDocs | integer |


setMergeFactor( $mergeFactor) : void
Set index mergeFactor option
Inherited from: \Zend_Search_Lucene_MultiSearcher::setMergeFactor()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
Name | Type | Description |
---|---|---|
$mergeFactor |


setResultSetLimit(integer $limit) : void
Set result set limit.
Inherited from: \Zend_Search_Lucene_MultiSearcher::setResultSetLimit()0 (default) means no limit
Name | Type | Description |
---|---|---|
$limit | integer |


skipTo(\Zend_Search_Lucene_Index_Term $prefix) : void
Skip terms stream up to specified term preffix.
Inherited from: \Zend_Search_Lucene_MultiSearcher::skipTo()Prefix contains fully specified field info and portion of searched term
Name | Type | Description |
---|---|---|
$prefix | \Zend_Search_Lucene_Index_Term |


termDocs(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : array
Returns IDs of all the documents containing term.
Inherited from: \Zend_Search_Lucene_MultiSearcher::termDocs()Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term | |
$docsFilter | \Zend_Search_Lucene_Index_DocsFilter | null |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


termDocsFilter(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : \Zend_Search_Lucene_Index_DocsFilter
Returns documents filter for all documents containing term.
Inherited from: \Zend_Search_Lucene_MultiSearcher::termDocsFilter()It performs the same operation as termDocs, but return result as Zend_Search_Lucene_Index_DocsFilter object
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term | |
$docsFilter | \Zend_Search_Lucene_Index_DocsFilter | null |
Type | Description |
---|---|
\Zend_Search_Lucene_Index_DocsFilter |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


termFreqs(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : integer
Returns an array of all term freqs.
Inherited from: \Zend_Search_Lucene_MultiSearcher::termFreqs()Return array structure: array( docId => freq, ...)
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term | |
$docsFilter | \Zend_Search_Lucene_Index_DocsFilter | null |
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


termPositions(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : array
Returns an array of all term positions in the documents.
Inherited from: \Zend_Search_Lucene_MultiSearcher::termPositions()Return array structure: array( docId => array( pos1, pos2, ...), ...)
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term | |
$docsFilter | \Zend_Search_Lucene_Index_DocsFilter | null |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


terms() : array
Returns an array of all terms in this index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::terms()Type | Description |
---|---|
array |


undeleteAll() : void
Undeletes all documents currently marked as deleted in this index.
Inherited from: \Zend_Search_Lucene_MultiSearcher::undeleteAll()\Zend_Search_Lucene_MultiSearcher
Multisearcher allows to search through several independent indexes.
- Implements
- \Zend_Search_Lucene_Interface
- Children
- \Zend_Search_Lucene_Interface_MultiSearcher
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties


callback $_documentDistributorCallBack = null
Callback used to choose target index for new documents
Function/method signature: Zend_Search_Lucene_Interface callbackFunction(Zend_Search_Lucene_Document $document, array $indices);
null means "default documents distributing algorithm"
null
Details- Type
- callback


array $_indices =
List of indices for searching.
Array of Zend_Search_Lucene_Interface objects
- Type
- array
Methods


__construct(array $indices = array()) : void
Object constructor.
Name | Type | Description |
---|---|---|
$indices | array | Arrays of indices for search |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


addDocument(\Zend_Search_Lucene_Document $document) : void
Adds a document to this index.
Name | Type | Description |
---|---|---|
$document | \Zend_Search_Lucene_Document |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


addIndex(\Zend_Search_Lucene_Interface $index) : void
Add index for searching.
Name | Type | Description |
---|---|---|
$index | \Zend_Search_Lucene_Interface |


closeTermsStream() : void
Close terms stream
Should be used for resources clean up if stream is not read up to the end


count() : integer
Returns the total number of documents in this index (including deleted documents).
Type | Description |
---|---|
integer |


currentTerm() : \Zend_Search_Lucene_Index_Term | null
Returns term in current position
Type | Description |
---|---|
\Zend_Search_Lucene_Index_Term | null |


delete(integer | \Zend_Search_Lucene_Search_QueryHit $id) : void
Deletes a document from the index.
$id is an internal document id
Name | Type | Description |
---|---|---|
$id | integer | \Zend_Search_Lucene_Search_QueryHit |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


docFreq(\Zend_Search_Lucene_Index_Term $term) : integer
Returns the number of documents in this index containing the $term.
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term |
Type | Description |
---|---|
integer |


find(mixed $query) : array
Performs a query against the index and returns an array of Zend_Search_Lucene_Search_QueryHit objects.
Input is a string or Zend_Search_Lucene_Search_Query.
Name | Type | Description |
---|---|---|
$query | mixed |
Type | Description |
---|---|
array | Zend_Search_Lucene_Search_QueryHit |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getActualGeneration(\Zend_Search_Lucene_Storage_Directory $directory) : integer
Get current generation number
Returns generation number 0 means pre-2.1 index format -1 means there are no segments files.
Name | Type | Description |
---|---|---|
$directory | \Zend_Search_Lucene_Storage_Directory |
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getDefaultSearchField() : string
Get default search field.
Null means, that search is performed through all fields by default
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getDirectory() : \Zend_Search_Lucene_Storage_Directory
Returns the Zend_Search_Lucene_Storage_Directory instance for this index.
Type | Description |
---|---|
\Zend_Search_Lucene_Storage_Directory |


getDocument(integer | \Zend_Search_Lucene_Search_QueryHit $id) : \Zend_Search_Lucene_Document
Returns a Zend_Search_Lucene_Document object for the document number $id in this index.
Name | Type | Description |
---|---|---|
$id | integer | \Zend_Search_Lucene_Search_QueryHit |
Type | Description |
---|---|
\Zend_Search_Lucene_Document |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception | Exception is thrown if $id is out of the range |


getDocumentDistributorCallback() : callback
Get callback for choosing target index.
Type | Description |
---|---|
callback |


getFieldNames(boolean $indexed = false) : array
Returns a list of all unique field names that exist in this index.
Name | Type | Description |
---|---|---|
$indexed | boolean |
Type | Description |
---|---|
array |


getFormatVersion() : integer
Get index format version
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getMaxBufferedDocs() : integer
Retrieve index maxBufferedDocs option
maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment
Default value is 10
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getMaxMergeDocs() : integer
Retrieve index maxMergeDocs option
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
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getMergeFactor() : integer
Retrieve index mergeFactor option
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
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getResultSetLimit() : integer
Set result set limit.
0 means no limit
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


getSegmentFileName(integer $generation) : string
Get segments file name
Name | Type | Description |
---|---|---|
$generation | integer |
Type | Description |
---|---|
string |


getSimilarity() : \Zend_Search_Lucene_Search_Similarity
Retrive similarity used by index reader
Type | Description |
---|---|
\Zend_Search_Lucene_Search_Similarity |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


hasDeletions() : boolean
Returns true if any documents have been deleted from this index.
Type | Description |
---|---|
boolean |


hasTerm(\Zend_Search_Lucene_Index_Term $term) : boolean
Returns true if index contain documents with specified term.
Is used for query optimization.
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term |
Type | Description |
---|---|
boolean |


isDeleted(integer $id) : boolean
Checks, that document is deleted
Name | Type | Description |
---|---|---|
$id | integer |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception | Exception is thrown if $id is out of the range |


maxDoc() : integer
Returns one greater than the largest possible document number.
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.
Type | Description |
---|---|
integer |


nextTerm() : \Zend_Search_Lucene_Index_Term | null
Scans terms dictionary and returns next term
Type | Description |
---|---|
\Zend_Search_Lucene_Index_Term | null |


norm(integer $id, string $fieldName) : float
Returns a normalization factor for "field, document" pair.
Name | Type | Description |
---|---|---|
$id | integer | |
$fieldName | string |
Type | Description |
---|---|
float |


numDocs() : integer
Returns the total number of non-deleted documents in this index.
Type | Description |
---|---|
integer |


setDefaultSearchField(string $fieldName) : void
Set default search field.
Null means, that search is performed through all fields by default
Default value is null
Name | Type | Description |
---|---|---|
$fieldName | string |


setDocumentDistributorCallback(callback $callback) : void
Set callback for choosing target index.
Name | Type | Description |
---|---|---|
$callback | callback |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


setFormatVersion(int $formatVersion) : void
Set index format version.
Index is converted to this format at the nearest upfdate time
Name | Type | Description |
---|---|---|
$formatVersion | int |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


setMaxBufferedDocs(integer $maxBufferedDocs) : void
Set index maxBufferedDocs option
maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment
Default value is 10
Name | Type | Description |
---|---|---|
$maxBufferedDocs | integer |


setMaxMergeDocs(integer $maxMergeDocs) : void
Set index maxMergeDocs option
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
Name | Type | Description |
---|---|---|
$maxMergeDocs | integer |


setMergeFactor( $mergeFactor) : void
Set index mergeFactor option
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
Name | Type | Description |
---|---|---|
$mergeFactor |


setResultSetLimit(integer $limit) : void
Set result set limit.
0 (default) means no limit
Name | Type | Description |
---|---|---|
$limit | integer |


skipTo(\Zend_Search_Lucene_Index_Term $prefix) : void
Skip terms stream up to specified term preffix.
Prefix contains fully specified field info and portion of searched term
Name | Type | Description |
---|---|---|
$prefix | \Zend_Search_Lucene_Index_Term |


termDocs(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : array
Returns IDs of all the documents containing term.
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term | |
$docsFilter | \Zend_Search_Lucene_Index_DocsFilter | null |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


termDocsFilter(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : \Zend_Search_Lucene_Index_DocsFilter
Returns documents filter for all documents containing term.
It performs the same operation as termDocs, but return result as Zend_Search_Lucene_Index_DocsFilter object
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term | |
$docsFilter | \Zend_Search_Lucene_Index_DocsFilter | null |
Type | Description |
---|---|
\Zend_Search_Lucene_Index_DocsFilter |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


termFreqs(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : integer
Returns an array of all term freqs.
Return array structure: array( docId => freq, ...)
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term | |
$docsFilter | \Zend_Search_Lucene_Index_DocsFilter | null |
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


termPositions(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : array
Returns an array of all term positions in the documents.
Return array structure: array( docId => array( pos1, pos2, ...), ...)
Name | Type | Description |
---|---|---|
$term | \Zend_Search_Lucene_Index_Term | |
$docsFilter | \Zend_Search_Lucene_Index_DocsFilter | null |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |