Zend Framework
1.12
|
Public Member Functions | |
__construct ($indices=array()) | |
Object constructor. | |
addIndex (Zend_Search_Lucene_Interface $index) | |
Add index for searching. | |
getFormatVersion () | |
Get index format version. | |
setFormatVersion ($formatVersion) | |
Set index format version. | |
getDirectory () | |
Returns the Zend_Search_Lucene_Storage_Directory instance for this index. | |
count () | |
Returns the total number of documents in this index (including deleted documents). | |
maxDoc () | |
Returns one greater than the largest possible document number. | |
numDocs () | |
Returns the total number of non-deleted documents in this index. | |
isDeleted ($id) | |
Checks, that document is deleted. | |
getMaxBufferedDocs () | |
Retrieve index maxBufferedDocs option. | |
setMaxBufferedDocs ($maxBufferedDocs) | |
Set index maxBufferedDocs option. | |
getMaxMergeDocs () | |
Retrieve index maxMergeDocs option. | |
setMaxMergeDocs ($maxMergeDocs) | |
Set index maxMergeDocs option. | |
getMergeFactor () | |
Retrieve index mergeFactor option. | |
setMergeFactor ($mergeFactor) | |
Set index mergeFactor option. | |
find ($query) | |
Performs a query against the index and returns an array of Zend_Search_Lucene_Search_QueryHit objects. | |
getFieldNames ($indexed=false) | |
Returns a list of all unique field names that exist in this index. | |
getDocument ($id) | |
Returns a Zend_Search_Lucene_Document object for the document number $id in this index. | |
hasTerm (Zend_Search_Lucene_Index_Term $term) | |
Returns true if index contain documents with specified term. | |
termDocs (Zend_Search_Lucene_Index_Term $term, $docsFilter=null) | |
Returns IDs of all the documents containing term. | |
termDocsFilter (Zend_Search_Lucene_Index_Term $term, $docsFilter=null) | |
Returns documents filter for all documents containing term. | |
termFreqs (Zend_Search_Lucene_Index_Term $term, $docsFilter=null) | |
Returns an array of all term freqs. | |
termPositions (Zend_Search_Lucene_Index_Term $term, $docsFilter=null) | |
Returns an array of all term positions in the documents. | |
docFreq (Zend_Search_Lucene_Index_Term $term) | |
Returns the number of documents in this index containing the $term. | |
getSimilarity () | |
Retrive similarity used by index reader. | |
norm ($id, $fieldName) | |
Returns a normalization factor for "field, document" pair. | |
hasDeletions () | |
Returns true if any documents have been deleted from this index. | |
delete ($id) | |
Deletes a document from the index. | |
setDocumentDistributorCallback ($callback) | |
Set callback for choosing target index. | |
getDocumentDistributorCallback () | |
Get callback for choosing target index. | |
addDocument (Zend_Search_Lucene_Document $document) | |
Adds a document to this index. | |
commit () | |
Commit changes resulting from delete() or undeleteAll() operations. | |
optimize () | |
Optimize index. | |
terms () | |
Returns an array of all terms in this index. | |
resetTermsStream () | |
Reset terms stream. | |
skipTo (Zend_Search_Lucene_Index_Term $prefix) | |
Skip terms stream up to specified term preffix. | |
nextTerm () | |
Scans terms dictionary and returns next term. | |
currentTerm () | |
Returns term in current position. | |
closeTermsStream () | |
Close terms stream. | |
undeleteAll () | |
Undeletes all documents currently marked as deleted in this index. | |
addReference () | |
Add reference to the index object. | |
removeReference () | |
Remove reference from the index object. | |
Static Public Member Functions | |
static | getActualGeneration (Zend_Search_Lucene_Storage_Directory $directory) |
Get current generation number. | |
static | getSegmentFileName ($generation) |
Get segments file name. | |
static | setDefaultSearchField ($fieldName) |
Set default search field. | |
static | getDefaultSearchField () |
Get default search field. | |
static | setResultSetLimit ($limit) |
Set result set limit. | |
static | getResultSetLimit () |
Set result set limit. | |
Protected Attributes | |
$_indices | |
$_documentDistributorCallBack = null | |
__construct | ( | $indices = array() | ) |
Object constructor.
array | $indices | Arrays of indices for search |
Zend_Search_Lucene_Exception |
addDocument | ( | Zend_Search_Lucene_Document | $document | ) |
Adds a document to this index.
Zend_Search_Lucene_Document | $document |
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
addIndex | ( | Zend_Search_Lucene_Interface | $index | ) |
Add index for searching.
Zend_Search_Lucene_Interface | $index |
addReference | ( | ) |
Add reference to the index object.
Implements Zend_Search_Lucene_Interface.
closeTermsStream | ( | ) |
Close terms stream.
Should be used for resources clean up if stream is not read up to the end
Implements Zend_Search_Lucene_Index_TermsStream_Interface.
commit | ( | ) |
Commit changes resulting from delete() or undeleteAll() operations.
Implements Zend_Search_Lucene_Interface.
count | ( | ) |
Returns the total number of documents in this index (including deleted documents).
Implements Zend_Search_Lucene_Interface.
currentTerm | ( | ) |
Returns term in current position.
Implements Zend_Search_Lucene_Index_TermsStream_Interface.
delete | ( | $id | ) |
Deletes a document from the index.
$id is an internal document id
integer | Zend_Search_Lucene_Search_QueryHit | $id |
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
docFreq | ( | Zend_Search_Lucene_Index_Term | $term | ) |
Returns the number of documents in this index containing the $term.
Zend_Search_Lucene_Index_Term | $term |
Implements Zend_Search_Lucene_Interface.
find | ( | $query | ) |
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.
mixed | $query |
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
|
static |
Get current generation number.
Returns generation number 0 means pre-2.1 index format -1 means there are no segments files.
Zend_Search_Lucene_Storage_Directory | $directory |
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
|
static |
Get default search field.
Null means, that search is performed through all fields by default
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
getDirectory | ( | ) |
Returns the Zend_Search_Lucene_Storage_Directory instance for this index.
Implements Zend_Search_Lucene_Interface.
getDocument | ( | $id | ) |
Returns a Zend_Search_Lucene_Document object for the document number $id in this index.
integer | Zend_Search_Lucene_Search_QueryHit | $id |
Zend_Search_Lucene_Exception | Exception is thrown if $id is out of the range |
Implements Zend_Search_Lucene_Interface.
getDocumentDistributorCallback | ( | ) |
Get callback for choosing target index.
getFieldNames | ( | $indexed = false | ) |
Returns a list of all unique field names that exist in this index.
boolean | $indexed |
Implements Zend_Search_Lucene_Interface.
getFormatVersion | ( | ) |
Get index format version.
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
getMaxBufferedDocs | ( | ) |
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
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
getMaxMergeDocs | ( | ) |
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
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
getMergeFactor | ( | ) |
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
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
|
static |
Set result set limit.
0 means no limit
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
|
static |
Get segments file name.
integer | $generation |
Implements Zend_Search_Lucene_Interface.
getSimilarity | ( | ) |
Retrive similarity used by index reader.
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
hasDeletions | ( | ) |
Returns true if any documents have been deleted from this index.
Implements Zend_Search_Lucene_Interface.
hasTerm | ( | Zend_Search_Lucene_Index_Term | $term | ) |
Returns true if index contain documents with specified term.
Is used for query optimization.
Zend_Search_Lucene_Index_Term | $term |
Implements Zend_Search_Lucene_Interface.
isDeleted | ( | $id | ) |
Checks, that document is deleted.
integer | $id |
Zend_Search_Lucene_Exception | Exception is thrown if $id is out of the range |
Implements Zend_Search_Lucene_Interface.
maxDoc | ( | ) |
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.
Implements Zend_Search_Lucene_Interface.
nextTerm | ( | ) |
Scans terms dictionary and returns next term.
Implements Zend_Search_Lucene_Index_TermsStream_Interface.
norm | ( | $id, | |
$fieldName | |||
) |
Returns a normalization factor for "field, document" pair.
integer | $id | |
string | $fieldName |
Implements Zend_Search_Lucene_Interface.
numDocs | ( | ) |
Returns the total number of non-deleted documents in this index.
Implements Zend_Search_Lucene_Interface.
optimize | ( | ) |
removeReference | ( | ) |
Remove reference from the index object.
When reference count becomes zero, index is closed and resources are cleaned up
Implements Zend_Search_Lucene_Interface.
resetTermsStream | ( | ) |
Reset terms stream.
Zend_Search_Lucene_TermStreamsPriorityQueue
Implements Zend_Search_Lucene_Index_TermsStream_Interface.
|
static |
Set default search field.
Null means, that search is performed through all fields by default
Default value is null
string | $fieldName |
Implements Zend_Search_Lucene_Interface.
setDocumentDistributorCallback | ( | $callback | ) |
Set callback for choosing target index.
callback | $callback |
Zend_Search_Lucene_Exception |
setFormatVersion | ( | $formatVersion | ) |
Set index format version.
Index is converted to this format at the nearest upfdate time
int | $formatVersion |
Implements Zend_Search_Lucene_Interface.
setMaxBufferedDocs | ( | $maxBufferedDocs | ) |
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
integer | $maxBufferedDocs |
Implements Zend_Search_Lucene_Interface.
setMaxMergeDocs | ( | $maxMergeDocs | ) |
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
integer | $maxMergeDocs |
Implements Zend_Search_Lucene_Interface.
setMergeFactor | ( | $mergeFactor | ) |
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
integer | $maxMergeDocs |
Implements Zend_Search_Lucene_Interface.
|
static |
Set result set limit.
0 (default) means no limit
integer | $limit |
Implements Zend_Search_Lucene_Interface.
skipTo | ( | Zend_Search_Lucene_Index_Term | $prefix | ) |
Skip terms stream up to specified term preffix.
Prefix contains fully specified field info and portion of searched term
Zend_Search_Lucene_Index_Term | $prefix |
Implements Zend_Search_Lucene_Index_TermsStream_Interface.
termDocs | ( | Zend_Search_Lucene_Index_Term | $term, |
$docsFilter = null |
|||
) |
Returns IDs of all the documents containing term.
Zend_Search_Lucene_Index_Term | $term | |
Zend_Search_Lucene_Index_DocsFilter | null | $docsFilter |
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
termDocsFilter | ( | Zend_Search_Lucene_Index_Term | $term, |
$docsFilter = null |
|||
) |
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
Zend_Search_Lucene_Index_Term | $term | |
Zend_Search_Lucene_Index_DocsFilter | null | $docsFilter |
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
termFreqs | ( | Zend_Search_Lucene_Index_Term | $term, |
$docsFilter = null |
|||
) |
Returns an array of all term freqs.
Return array structure: array( docId => freq, ...)
Zend_Search_Lucene_Index_Term | $term | |
Zend_Search_Lucene_Index_DocsFilter | null | $docsFilter |
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
termPositions | ( | Zend_Search_Lucene_Index_Term | $term, |
$docsFilter = null |
|||
) |
Returns an array of all term positions in the documents.
Return array structure: array( docId => array( pos1, pos2, ...), ...)
Zend_Search_Lucene_Index_Term | $term | |
Zend_Search_Lucene_Index_DocsFilter | null | $docsFilter |
Zend_Search_Lucene_Exception |
Implements Zend_Search_Lucene_Interface.
terms | ( | ) |
undeleteAll | ( | ) |
Undeletes all documents currently marked as deleted in this index.
Implements Zend_Search_Lucene_Interface.
|
protected |
|
protected |