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 license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Search_Lucene
- Version
- $Id$
\Zend_Search_Lucene_Interface_MultiSearcher
Package: Zend_Search_LuceneThis class is provided for backwards-compatibility (See ZF-12067)
- Parent(s)
- \Zend_Search_Lucene_MultiSearcher
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
\Zend_Search_Lucene_MultiSearcher
Package: Zend_Search_LuceneMultisearcher allows to search through several independent indexes.
- Implements
- Children
- \Zend_Search_Lucene_Interface_MultiSearcher
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 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"
Default valuenull
Details- Type
- callback
array $_indices
List of indices for searching.
Array of Zend_Search_Lucene_Interface objects
Details- Type
- array
Methods
__construct(array $indices = array()) : void
ParametersName | Type | Description |
---|
$indices | array | Arrays of indices for search |
---|
Throws 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.
ParametersName | Type | Description |
---|
$query | mixed | |
---|
ReturnsType | Description |
---|
array | Zend_Search_Lucene_Search_QueryHit |
ThrowsgetActualGeneration(\Zend_Search_Lucene_Storage_Directory $directory) : integer
staticGet current generation number
Returns generation number
0 means pre-2.1 index format
-1 means there are no segments files.
ParametersReturnsThrowsgetDefaultSearchField() : string
staticGet default search field.
Null means, that search is performed through all fields by default
ReturnsThrowsgetFieldNames(boolean $indexed = false) : array
Returns a list of all unique field names that exist in this index.
ParametersName | Type | Description |
---|
$indexed | boolean | |
---|
Returns 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
ReturnsThrowsgetMaxMergeDocs() : 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
ReturnsThrowsgetMergeFactor() : 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
ReturnsThrowsgetResultSetLimit() : integer
staticSet result set limit.
0 means no limit
ReturnsThrowsgetSegmentFileName(integer $generation) : string
staticGet segments file name
ParametersName | Type | Description |
---|
$generation | integer | |
---|
Returns hasTerm(\Zend_Search_Lucene_Index_Term $term) : boolean
Returns true if index contain documents with specified term.
Is used for query optimization.
ParametersReturnsisDeleted(integer $id) : boolean
Checks, that document is deleted
ParametersName | Type | Description |
---|
$id | integer | |
---|
ReturnsThrows 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.
Returnsnorm(integer $id, string $fieldName) : float
Returns a normalization factor for "field, document" pair.
ParametersName | Type | Description |
---|
$id | integer | |
---|
$fieldName | string | |
---|
Returns setDefaultSearchField(string $fieldName) : void
staticSet default search field.
Null means, that search is performed through all fields by default
Default value is null
ParametersName | Type | Description |
---|
$fieldName | string | |
---|
setDocumentDistributorCallback(callback $callback) : void
Set callback for choosing target index.
ParametersName | Type | Description |
---|
$callback | callback | |
---|
Throws setFormatVersion(int $formatVersion) : void
Set index format version.
Index is converted to this format at the nearest upfdate time
ParametersName | Type | Description |
---|
$formatVersion | int | |
---|
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
ParametersName | 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
ParametersName | 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
ParametersName | Type | Description |
---|
$mergeFactor | | |
---|
setResultSetLimit(integer $limit) : void
staticSet result set limit.
0 (default) means no limit
ParametersName | 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
Parameters