31#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H
32#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H
34#include "llvm/Support/raw_ostream.h"
107 virtual llvm::raw_ostream &dump(llvm::raw_ostream &
OS)
const = 0;
119std::vector<std::pair<DocID, float>>
consume(Iterator &It);
124template <
typename... TailT>
126 std::unique_ptr<Iterator>
Head, TailT...
Tail) {
144 std::unique_ptr<Iterator>
152 std::unique_ptr<Iterator>
157 std::unique_ptr<Iterator>
all()
const;
160 std::unique_ptr<Iterator>
none()
const;
166 std::unique_ptr<Iterator>
boost(std::unique_ptr<Iterator> Child,
173 std::unique_ptr<Iterator>
limit(std::unique_ptr<Iterator> Child,
177 template <
typename...
Args>
179 std::vector<std::unique_ptr<Iterator>>
Children;
185 template <
typename...
Args>
187 std::vector<std::unique_ptr<Iterator>>
Children;
std::unique_ptr< Iterator > none() const
Returns FALSE Iterator which iterates over no documents.
std::unique_ptr< Iterator > intersect(Args... args) const
This allows intersect(create(...), create(...)) syntax.
std::unique_ptr< Iterator > limit(std::unique_ptr< Iterator > Child, size_t Limit) const
Returns LIMIT iterator, which yields up to N elements of its child iterator.
std::unique_ptr< Iterator > intersect(std::vector< std::unique_ptr< Iterator > > Children) const
Returns AND Iterator which performs the intersection of the PostingLists of its children.
std::unique_ptr< Iterator > boost(std::unique_ptr< Iterator > Child, float Factor) const
Returns BOOST iterator which multiplies the score of each item by given factor.
std::unique_ptr< Iterator > all() const
Returns TRUE Iterator which iterates over "virtual" PostingList containing all items in range [0,...
std::unique_ptr< Iterator > unionOf(Args... args) const
This allows unionOf(create(...), create(...)) syntax.
std::unique_ptr< Iterator > unionOf(std::vector< std::unique_ptr< Iterator > > Children) const
Returns OR Iterator which performs the union of the PostingLists of its children.
Iterator is the interface for Query Tree node.
virtual float consume()=0
Informs the iterator that the current document was consumed, and returns its boost.
Iterator(Kind MyKind=Kind::Other)
virtual bool reachedEnd() const =0
Returns true if all valid DocIDs were processed and hence the iterator is exhausted.
virtual void advance()=0
Moves to next valid DocID.
friend llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const Iterator &Iterator)
Prints a convenient human-readable iterator representation by recursively dumping iterators in the fo...
virtual DocID peek() const =0
Returns the current element this iterator points to.
Kind
Inspect iterator type, used internally for optimizing query trees.
virtual size_t estimateSize() const =0
Returns an estimate of advance() calls before the iterator is exhausted.
virtual void advanceTo(DocID ID)=0
Moves to the first valid DocID which is equal or higher than given ID.
void populateChildren(std::vector< std::unique_ptr< Iterator > > &)
std::vector< std::pair< DocID, float > > consume(Iterator &It)
Advances the iterator until it is exhausted.
uint32_t DocID
Symbol position in the list of all index symbols sorted by a pre-computed symbol quality.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//