Constants

RESULTS_PER_BLOCK

RESULTS_PER_BLOCK

Default number of documents returned for each block (at most)

Properties

$num_docs

$num_docs : integer

Estimate of the number of documents that this iterator can return

Type

integer

$seen_docs

$seen_docs : integer

The number of documents already iterated over

Type

integer

$count_block

$count_block : integer

The number of documents in the current block

Type

integer

$pages

$pages : array

Cache of what currentDocsWithWord returns

Type

array

$current_block_fresh

$current_block_fresh : boolean

Says whether the value in $this->count_block is up to date

Type

boolean

$results_per_block

$results_per_block : integer

Number of documents returned for each block (at most)

Type

integer

$index_bundle_iterators

$index_bundle_iterators : array

An array of iterators whose interection we get documents from

Type

array

$num_iterators

$num_iterators : integer

Number of elements in $this->index_bundle_iterators

Type

integer

$to_advance_index

$to_advance_index : integer

Index of the iterator amongst those we are intersecting to advance next

Type

integer

Methods

reset()

reset() 

Returns the iterators to the first document block that it could iterate over

advance()

advance(array  $gen_doc_offset = null) 

Forwards the iterator one group of docs (must be size 1)

Parameters

array $gen_doc_offset

a generation, doc_offset pair. If set, the must be of greater than or equal generation, and if equal the next block must all have $doc_offsets larger than or equal to this value

currentGenDocOffsetWithWord()

currentGenDocOffsetWithWord() : mixed

Gets the doc_offset and generation for the next document that would be return by this iterator

Returns

mixed —

an array with the desired document offset and generation; -1 on fail

findDocsWithWord()

findDocsWithWord() : mixed

Hook function used by currentDocsWithWord to return the current block of docs if it is not cached

Returns

mixed —

doc ids and rank if there are docs left, -1 otherwise

plan()

plan() : string

Returns a string representation of a plan by which the current iterator finds its results

Returns

string —

a representation of the current iterator and its subiterators, useful for determining how a query will be processed

genDocOffsetCmp()

genDocOffsetCmp(array  $gen_doc1, array  $gen_doc2, integer  $direction = self::ASCENDING) : integer

Compares two arrays each containing a (generation, offset) pair.

Parameters

array $gen_doc1

first ordered pair

array $gen_doc2

second ordered pair

integer $direction

whether the comparison should be done for a self::ASCEDNING or a self::DESCENDING search

Returns

integer —

-1,0,1 depending on which is bigger

getDirection()

getDirection() : integer

Returns CrawlConstants::ASCENDING or CrawlConstants::DESCENDING depending on the direction in which this iterator ttraverse the underlying index archive bundle.

Returns

integer —

direction traversing underlying archive bundle

currentDocsWithWord()

currentDocsWithWord() : mixed

Gets the current block of doc ids and score associated with the this iterators word

Returns

mixed —

doc ids and score if there are docs left, -1 otherwise

getCurrentDocsForKeys()

getCurrentDocsForKeys(array  $keys = null) : array

Gets the summaries associated with the keys provided the keys can be found in the current block of docs returned by this iterator

Parameters

array $keys

keys to try to find in the current block of returned results

Returns

array —

doc summaries that match provided keys

nextDocsWithWord()

nextDocsWithWord(  $doc_offset = null) : array

Get the current block of doc summaries for the word iterator and advances the current pointer to the next block of documents. If a doc index is the next block must be of docs after this doc_index

Parameters

$doc_offset

if set the next block must all have $doc_offsets equal to or larger than this value

Returns

array —

doc summaries matching the $this->restrict_phrases

advanceSeenDocs()

advanceSeenDocs() 

Updates the seen_docs count during an advance() call

setResultsPerBlock()

setResultsPerBlock(integer  $num) 

This method is supposed to set the value of the result_per_block field. This field controls the maximum number of results that can be returned in one go by currentDocsWithWord(). This method cannot be consistently implemented for this iterator and expect it to behave nicely it this iterator is used together with union_iterator. So to prevent a user for doing this, calling this method results in a user defined error

Parameters

integer $num

the maximum number of results that can be returned by a block

__construct()

__construct(object  $index_bundle_iterator) 

Creates a negation iterator with the given parameters.

Parameters

object $index_bundle_iterator

to use as a source of documents to iterate over

syncGenDocOffsetsAmongstIterators()

syncGenDocOffsetsAmongstIterators() 

Finds the next generation and doc offset amongst the all docs iterator and the term to be negated iterator such that the all iterator is strictly less than the term iterator.