Zend Framework
1.12
|
Public Member Functions | |
__construct (Zend_Search_Lucene_Storage_Directory $directory, $name, $docCount, $delGen=0, $docStoreOptions=null, $hasSingleNormFile=false, $isCompound=null) | |
Zend_Search_Lucene_Index_SegmentInfo constructor. | |
openCompoundFile ($extension, $shareHandler=true) | |
Opens index file stoted within compound index file. | |
compoundFileLength ($extension) | |
Get compound file length. | |
getFieldNum ($fieldName) | |
Returns field index or -1 if field is not found. | |
getField ($fieldNum) | |
Returns field info for specified field. | |
getFields ($indexed=false) | |
Returns array of fields. | |
getFieldInfos () | |
Returns array of FieldInfo objects. | |
getDelGen () | |
Returns actual deletions file generation number. | |
count () | |
Returns the total number of documents in this segment (including deleted documents). | |
numDocs () | |
Returns the total number of non-deleted documents in this segment. | |
getName () | |
Return segment name. | |
getTermInfo (Zend_Search_Lucene_Index_Term $term) | |
Scans terms dictionary and returns term info. | |
termDocs (Zend_Search_Lucene_Index_Term $term, $shift=0, $docsFilter=null) | |
Returns IDs of all the documents containing term. | |
termFreqs (Zend_Search_Lucene_Index_Term $term, $shift=0, $docsFilter=null) | |
Returns term freqs array. | |
termPositions (Zend_Search_Lucene_Index_Term $term, $shift=0, $docsFilter=null) | |
Returns term positions array. | |
norm ($id, $fieldName) | |
Returns normalization factor for specified documents. | |
normVector ($fieldName) | |
Returns norm vector, encoded in a byte string. | |
hasDeletions () | |
Returns true if any documents have been deleted from this index segment. | |
hasSingleNormFile () | |
Returns true if segment has single norms file. | |
isCompound () | |
Returns true if segment is stored using compound segment file. | |
delete ($id) | |
Deletes a document from the index segment. | |
isDeleted ($id) | |
Checks, that document is deleted. | |
writeChanges () | |
Write changes if it's necessary. | |
resetTermsStream () | |
Reset terms stream. | |
skipTo (Zend_Search_Lucene_Index_Term $prefix) | |
Skip terms stream up to the specified term preffix. | |
nextTerm () | |
Scans terms dictionary and returns next term. | |
closeTermsStream () | |
Close terms stream. | |
currentTerm () | |
Returns term in current position. | |
currentTermPositions () | |
Returns an array of all term positions in the documents. | |
Public Attributes | |
const | FULL_SCAN_VS_FETCH_BOUNDARY = 5 |
"Full scan vs fetch" boundary. | |
const | SM_TERMS_ONLY = 0 |
Scan modes. | |
const | SM_FULL_INFO = 1 |
const | SM_MERGE_INFO = 2 |
__construct | ( | Zend_Search_Lucene_Storage_Directory | $directory, |
$name, | |||
$docCount, | |||
$delGen = 0 , |
|||
$docStoreOptions = null , |
|||
$hasSingleNormFile = false , |
|||
$isCompound = null |
|||
) |
Zend_Search_Lucene_Index_SegmentInfo constructor.
Zend_Search_Lucene_Storage_Directory | $directory | |
string | $name | |
integer | $docCount | |
integer | $delGen | |
array | null | $docStoreOptions | |
boolean | $hasSingleNormFile | |
boolean | $isCompound |
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.
compoundFileLength | ( | $extension | ) |
Get compound file length.
string | $extension |
count | ( | ) |
Returns the total number of documents in this segment (including deleted documents).
currentTerm | ( | ) |
Returns term in current position.
Implements Zend_Search_Lucene_Index_TermsStream_Interface.
currentTermPositions | ( | ) |
Returns an array of all term positions in the documents.
Return array structure: array( docId => array( pos1, pos2, ...), ...)
delete | ( | $id | ) |
Deletes a document from the index segment.
$id is an internal document id
integer |
getDelGen | ( | ) |
Returns actual deletions file generation number.
getField | ( | $fieldNum | ) |
Returns field info for specified field.
integer | $fieldNum |
getFieldInfos | ( | ) |
Returns array of FieldInfo objects.
getFieldNum | ( | $fieldName | ) |
Returns field index or -1 if field is not found.
string | $fieldName |
getFields | ( | $indexed = false | ) |
Returns array of fields.
if $indexed parameter is true, then returns only indexed fields.
boolean | $indexed |
getName | ( | ) |
Return segment name.
getTermInfo | ( | Zend_Search_Lucene_Index_Term | $term | ) |
Scans terms dictionary and returns term info.
Zend_Search_Lucene_Index_Term | $term |
hasDeletions | ( | ) |
Returns true if any documents have been deleted from this index segment.
hasSingleNormFile | ( | ) |
Returns true if segment has single norms file.
isCompound | ( | ) |
Returns true if segment is stored using compound segment file.
isDeleted | ( | $id | ) |
Checks, that document is deleted.
integer |
nextTerm | ( | ) |
Scans terms dictionary and returns next term.
Implements Zend_Search_Lucene_Index_TermsStream_Interface.
norm | ( | $id, | |
$fieldName | |||
) |
Returns normalization factor for specified documents.
integer | $id | |
string | $fieldName |
normVector | ( | $fieldName | ) |
Returns norm vector, encoded in a byte string.
string | $fieldName |
numDocs | ( | ) |
Returns the total number of non-deleted documents in this segment.
openCompoundFile | ( | $extension, | |
$shareHandler = true |
|||
) |
Opens index file stoted within compound index file.
string | $extension | |
boolean | $shareHandler |
Zend_Search_Lucene_Exception |
resetTermsStream | ( | ) |
Reset terms stream.
$startId - id for the fist document $compact - remove deleted documents
Returns start document id for the next segment
integer | $startId | |
integer | $mode |
Zend_Search_Lucene_Exception |
SegmentInfo->resetTermsStream() method actually takes two optional parameters: $startId (default value is 0) $mode (default value is self::SM_TERMS_ONLY)
Implements Zend_Search_Lucene_Index_TermsStream_Interface.
skipTo | ( | Zend_Search_Lucene_Index_Term | $prefix | ) |
Skip terms stream up to the specified term preffix.
Prefix contains fully specified field info and portion of searched term
Zend_Search_Lucene_Index_Term | $prefix |
Zend_Search_Lucene_Exception |
Field is not presented in this segment Go to the end of dictionary
Implements Zend_Search_Lucene_Index_TermsStream_Interface.
termDocs | ( | Zend_Search_Lucene_Index_Term | $term, |
$shift = 0 , |
|||
$docsFilter = null |
|||
) |
Returns IDs of all the documents containing term.
Zend_Search_Lucene_Index_Term | $term | |
integer | $shift | |
Zend_Search_Lucene_Index_DocsFilter | null | $docsFilter |
termFreqs | ( | Zend_Search_Lucene_Index_Term | $term, |
$shift = 0 , |
|||
$docsFilter = null |
|||
) |
Returns term freqs array.
Result array structure: array(docId => freq, ...)
Zend_Search_Lucene_Index_Term | $term | |
integer | $shift | |
Zend_Search_Lucene_Index_DocsFilter | null | $docsFilter |
termPositions | ( | Zend_Search_Lucene_Index_Term | $term, |
$shift = 0 , |
|||
$docsFilter = null |
|||
) |
Returns term positions array.
Result array structure: array(docId => array(pos1, pos2, ...), ...)
Zend_Search_Lucene_Index_Term | $term | |
integer | $shift | |
Zend_Search_Lucene_Index_DocsFilter | null | $docsFilter |
writeChanges | ( | ) |
Write changes if it's necessary.
This method must be invoked only from the Writer _updateSegments() method, so index Write lock has to be already obtained.
const FULL_SCAN_VS_FETCH_BOUNDARY = 5 |
"Full scan vs fetch" boundary.
If filter selectivity is less than this value, then full scan is performed (since term entries fetching has some additional overhead).
const SM_FULL_INFO = 1 |
const SM_MERGE_INFO = 2 |
const SM_TERMS_ONLY = 0 |
Scan modes.