HumHub Documentation (unofficial)

SearchIndexInterface extends TermsStreamInterface

Tags
category

Zend

Table of Contents

Methods

addDocument()  : mixed
Adds a document to this index.
closeTermsStream()  : mixed
Close terms stream
commit()  : mixed
Commit changes resulting from delete() or undeleteAll() operations.
count()  : int
Returns the total number of documents in this index (including deleted documents).
currentTerm()  : Term|null
Returns term in current position
delete()  : mixed
Deletes a document from the index.
docFreq()  : int
Returns the number of documents in this index containing the $term.
find()  : array<string|int, mixed>|QueryHit
Performs a query against the index and returns an array of Zend_Search_Lucene_Search_QueryHit objects.
getActualGeneration()  : int
Get current generation number
getDirectory()  : DirectoryInterface
Returns the ZendSearch\Lucene\Storage\Directory\DirectoryInterface instance for this index.
getDocument()  : Document
Returns a Zend_Search_Lucene_Document object for the document number $id in this index.
getFieldNames()  : array<string|int, mixed>
Returns a list of all unique field names that exist in this index.
getFormatVersion()  : int
Get index format version
getMaxBufferedDocs()  : int
Retrieve index maxBufferedDocs option
getMaxMergeDocs()  : int
Retrieve index maxMergeDocs option
getMergeFactor()  : int
Retrieve index mergeFactor option
getSegmentFileName()  : string
Get segments file name
getSimilarity()  : AbstractSimilarity
Retrive similarity used by index reader
hasDeletions()  : bool
Returns true if any documents have been deleted from this index.
hasTerm()  : bool
Returns true if index contain documents with specified term.
isDeleted()  : bool
Checks, that document is deleted
maxDoc()  : int
Returns one greater than the largest possible document number.
nextTerm()  : Term|null
Scans terms dictionary and returns next term
norm()  : float
Returns a normalization factor for "field, document" pair.
numDocs()  : int
Returns the total number of non-deleted documents in this index.
optimize()  : mixed
Optimize index.
resetTermsStream()  : mixed
Reset terms stream.
setFormatVersion()  : mixed
Set index format version.
setMaxBufferedDocs()  : mixed
Set index maxBufferedDocs option
setMaxMergeDocs()  : mixed
Set index maxMergeDocs option
setMergeFactor()  : mixed
Set index mergeFactor option
skipTo()  : mixed
Skip terms stream up to specified term preffix.
termDocs()  : array<string|int, mixed>
Returns IDs of all the documents containing term.
termDocsFilter()  : DocsFilter
Returns documents filter for all documents containing term.
termFreqs()  : int
Returns an array of all term freqs.
termPositions()  : array<string|int, mixed>
Returns an array of all term positions in the documents.
terms()  : array<string|int, mixed>
Returns an array of all terms in this index.
undeleteAll()  : mixed
Undeletes all documents currently marked as deleted in this index.

Methods

closeTermsStream()

Close terms stream

public closeTermsStream() : mixed

Should be used for resources clean up if stream is not read up to the end

commit()

Commit changes resulting from delete() or undeleteAll() operations.

public commit() : mixed

count()

Returns the total number of documents in this index (including deleted documents).

public count() : int
Return values
int

docFreq()

Returns the number of documents in this index containing the $term.

public docFreq(Term $term) : int
Parameters
$term : Term
Return values
int

find()

Performs a query against the index and returns an array of Zend_Search_Lucene_Search_QueryHit objects.

public find(mixed $query) : array<string|int, mixed>|QueryHit

Input is a string or Zend_Search_Lucene_Search_Query.

Parameters
$query : mixed
Tags
throws
ExceptionInterface
Return values
array<string|int, mixed>|QueryHit

getFieldNames()

Returns a list of all unique field names that exist in this index.

public getFieldNames([bool $indexed = false ]) : array<string|int, mixed>
Parameters
$indexed : bool = false
Return values
array<string|int, mixed>

getFormatVersion()

Get index format version

public getFormatVersion() : int
Return values
int

getMaxBufferedDocs()

Retrieve index maxBufferedDocs option

public getMaxBufferedDocs() : int

maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment

Return values
int

getMaxMergeDocs()

Retrieve index maxMergeDocs option

public getMaxMergeDocs() : int

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.

Return values
int

getMergeFactor()

Retrieve index mergeFactor option

public getMergeFactor() : int

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.

Return values
int

getSegmentFileName()

Get segments file name

public static getSegmentFileName(int $generation) : string
Parameters
$generation : int
Return values
string

hasDeletions()

Returns true if any documents have been deleted from this index.

public hasDeletions() : bool
Return values
bool

hasTerm()

Returns true if index contain documents with specified term.

public hasTerm(Term $term) : bool

Is used for query optimization.

Parameters
$term : Term
Return values
bool

isDeleted()

Checks, that document is deleted

public isDeleted(int $id) : bool
Parameters
$id : int
Tags
throws
ExceptionInterface

Exception is thrown if $id is out of the range

Return values
bool

maxDoc()

Returns one greater than the largest possible document number.

public maxDoc() : int

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.

Return values
int

norm()

Returns a normalization factor for "field, document" pair.

public norm(int $id, string $fieldName) : float
Parameters
$id : int
$fieldName : string
Return values
float

numDocs()

Returns the total number of non-deleted documents in this index.

public numDocs() : int
Return values
int

setFormatVersion()

Set index format version.

public setFormatVersion(int $formatVersion) : mixed

Index is converted to this format at the nearest upfdate time

Parameters
$formatVersion : int
Tags
throws
ExceptionInterface

setMaxBufferedDocs()

Set index maxBufferedDocs option

public setMaxBufferedDocs(int $maxBufferedDocs) : mixed

maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment

Parameters
$maxBufferedDocs : int

setMaxMergeDocs()

Set index maxMergeDocs option

public setMaxMergeDocs(int $maxMergeDocs) : mixed

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.

Parameters
$maxMergeDocs : int

setMergeFactor()

Set index mergeFactor option

public setMergeFactor(mixed $mergeFactor) : mixed

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.

Parameters
$mergeFactor : mixed

skipTo()

Skip terms stream up to specified term preffix.

public skipTo(Term $prefix) : mixed

Prefix contains fully specified field info and portion of searched term

Parameters
$prefix : Term

termDocs()

Returns IDs of all the documents containing term.

public termDocs(Term $term[, DocsFilter|null $docsFilter = null ]) : array<string|int, mixed>
Parameters
$term : Term
$docsFilter : DocsFilter|null = null
Return values
array<string|int, mixed>

termDocsFilter()

Returns documents filter for all documents containing term.

public termDocsFilter(Term $term[, DocsFilter|null $docsFilter = null ]) : DocsFilter

It performs the same operation as termDocs, but return result as Zend_Search_Lucene_Index_DocsFilter object

Parameters
$term : Term
$docsFilter : DocsFilter|null = null
Return values
DocsFilter

termFreqs()

Returns an array of all term freqs.

public termFreqs(Term $term[, DocsFilter|null $docsFilter = null ]) : int

Return array structure: array( docId => freq, ...)

Parameters
$term : Term
$docsFilter : DocsFilter|null = null
Return values
int

termPositions()

Returns an array of all term positions in the documents.

public termPositions(Term $term[, DocsFilter|null $docsFilter = null ]) : array<string|int, mixed>

Return array structure: array( docId => array( pos1, pos2, ...), ...)

Parameters
$term : Term
$docsFilter : DocsFilter|null = null
Return values
array<string|int, mixed>

terms()

Returns an array of all terms in this index.

public terms() : array<string|int, mixed>
Return values
array<string|int, mixed>

undeleteAll()

Undeletes all documents currently marked as deleted in this index.

public undeleteAll() : mixed

        
On this page

Search results