Search/Lucene.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$
Package: Zend_Search_Lucene- Implements
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants


GENERATION_RETRIEVE_COUNT
= 10Generation retrieving counter


GENERATION_RETRIEVE_PAUSE
= 50Pause between generation retrieving attempts in milliseconds
Properties



boolean $_closeDirOnExit = trueFile system adapter closing option
Default valuetrueDetails- Type
- boolean



boolean $_closed = falseSignal, that index is already closed, changes are fixed and resources are cleaned up
Default valuefalseDetails- Type
- boolean



string $_defaultSearchField = nullstaticDefault field name for search
Null means search through all fields
Default valuenullDetails- Type
- string



integer $_docCount = 0Number of documents in this index.
Default value0Details- Type
- integer



integer $_refCount = 0Number of references to the index object
Default value0Details- Type
- integer



array $_segmentInfos = array()Array of Zend_Search_Lucene_Index_SegmentInfo objects for current version of index.
Default valuearray()Details- Type
- array



integer $_termsPerQueryLimit = 1024staticTerms per query limit
0 means no limit
Default value1024Details- Type
- integer
Methods



commit() : voidCommit changes resulting from delete() or undeleteAll() operations.
Details- Todo
- undeleteAll processing.



find(\Zend_Search_Lucene_Search_QueryParser | string $query) : arrayPerforms 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.
ParametersReturns| Type | Description |
|---|
| array | Zend_Search_Lucene_Search_QueryHit |
Throws


getActualGeneration(\Zend_Search_Lucene_Storage_Directory $directory) : integerstaticGet current generation number
Returns generation number
0 means pre-2.1 index format
-1 means there are no segments files.
ParametersReturnsThrows


getDefaultSearchField() : stringstaticGet default search field.
Null means, that search is performed through all fields by default
Returns


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


getGeneration() : integerGet generation number associated with this index instance
The same generation number in pair with document number or query string
guarantees to give the same result while index retrieving.
So it may be used for search result caching.
Returns


getMaxBufferedDocs() : integerRetrieve 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
Returns


getMaxMergeDocs() : integerRetrieve 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
Returns


getMergeFactor() : integerRetrieve 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
Returns


getSegmentFileName(integer $generation) : stringstaticGet segments file name
Parameters| Name | Type | Description |
|---|
| $generation | integer | |
|---|
Returns 


getTermsPerQueryLimit() : integerstaticGet result set limit.
0 (default) means no limit
Returns


hasTerm(\Zend_Search_Lucene_Index_Term $term) : booleanReturns true if index contain documents with specified term.
Is used for query optimization.
ParametersReturns


isDeleted(integer $id) : booleanChecks, that document is deleted
Parameters| Name | Type | Description |
|---|
| $id | integer | |
|---|
ReturnsThrows 


maxDoc() : integerReturns 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.
Returns


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


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



setFormatVersion(int $formatVersion) : voidSet index format version.
Index is converted to this format at the nearest upfdate time
Parameters| Name | Type | Description |
|---|
| $formatVersion | int | |
|---|
Throws


setMaxBufferedDocs(integer $maxBufferedDocs) : voidSet 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
Parameters| Name | Type | Description |
|---|
| $maxBufferedDocs | integer | |
|---|



setMaxMergeDocs(integer $maxMergeDocs) : voidSet 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
Parameters| Name | Type | Description |
|---|
| $maxMergeDocs | integer | |
|---|



setMergeFactor( $mergeFactor) : voidSet 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
Parameters| Name | Type | Description |
|---|
| $mergeFactor | | |
|---|



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



setTermsPerQueryLimit(integer $limit) : voidstaticSet terms per query limit.
0 means no limit
Parameters| Name | Type | Description |
|---|
| $limit | integer | |
|---|



skipTo(\Zend_Search_Lucene_Index_Term $prefix) : voidSkip terms stream up to the specified term preffix.
Prefix contains fully specified field info and portion of searched term
Parameters


undeleteAll() : voidUndeletes all documents currently marked as deleted in this index.
Details- Todo
- Implementation