RESULTS_PER_BLOCK
RESULTS_PER_BLOCK
Default number of documents returned for each block (at most)
Used to iterate through all the documents and links associated with a an IndexArchiveBundle. It iterates through each doc or link regarless of the words it contains. It also makes it easy to get the summaries of these documents.
A description of how words and the documents containing them are stored is given in the documentation of IndexArchiveBundle.
genDocOffsetCmp(array $gen_doc1, array $gen_doc2, integer $direction = self::ASCENDING) : integer
Compares two arrays each containing a (generation, offset) pair.
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 |
-1,0,1 depending on which is bigger
getDirection() : integer
Returns the direction of a IndexBundleIterator. Depending on the iterator could be either forward from the start of an index (self::ASCENDING) or backward from the end of the index (self::DESCENDING). For this base class, the function always returns self::ASCENDING, but subclasses might return different values.
either CrawlConstants::ASCENDING or CrawlConstants::DESCENDING
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
array | $keys | keys to try to find in the current block of returned results |
doc summaries that match provided keys
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
$doc_offset | if set the next block must all have $doc_offsets equal to or larger than this value |
doc summaries matching the $this->restrict_phrases
__construct(string $index_name, \seekquarry\yioop\library\index_bundle_iterators\SearchfiltersModel $filter = null, integer $results_per_block = \seekquarry\yioop\library\index_bundle_iterators\IndexBundleIterator::RESULTS_PER_BLOCK, integer $direction = self::ASCENDING)
Creates a word iterator with the given parameters.
string | $index_name | time_stamp of the to use |
\seekquarry\yioop\library\index_bundle_iterators\SearchfiltersModel | $filter | Model responsible for keeping track of edited and deleted search results |
integer | $results_per_block | the maximum number of results that can be returned by a findDocsWithWord call |
integer | $direction | when results are access from $index_name in which order they should be presented. self::ASCENDING is from first added to last added, self::DESCENDING is from last added to first added. Note: this value is not saved permanently. So you could in theory open two read only versions of the same bundle but reading the results in different directions |
getShardInfo( $generation)
Mainly used to get the last_offset in shard $generation of the current index bundle. In the case where this wasn't previously cached it loads in the index bundle, sets the current generation to $generation, stores the docids_len (the last offset) of this shard in shard_lens and sets up last_offset as $generation's docids_len
$generation | to get last offset for |