clang-tools 19.0.0git
Public Member Functions | List of all members
clang::clangd::dex::Corpus Class Reference

#include <Iterator.h>

Public Member Functions

 Corpus (DocID Size)
 
std::unique_ptr< Iteratorintersect (std::vector< std::unique_ptr< Iterator > > Children) const
 Returns AND Iterator which performs the intersection of the PostingLists of its children.
 
std::unique_ptr< IteratorunionOf (std::vector< std::unique_ptr< Iterator > > Children) const
 Returns OR Iterator which performs the union of the PostingLists of its children.
 
std::unique_ptr< Iteratorall () const
 Returns TRUE Iterator which iterates over "virtual" PostingList containing all items in range [0, Size) in an efficient manner.
 
std::unique_ptr< Iteratornone () const
 Returns FALSE Iterator which iterates over no documents.
 
std::unique_ptr< Iteratorboost (std::unique_ptr< Iterator > Child, float Factor) const
 Returns BOOST iterator which multiplies the score of each item by given factor.
 
std::unique_ptr< Iteratorlimit (std::unique_ptr< Iterator > Child, size_t Limit) const
 Returns LIMIT iterator, which yields up to N elements of its child iterator.
 
template<typename... Args>
std::unique_ptr< Iteratorintersect (Args... args) const
 This allows intersect(create(...), create(...)) syntax.
 
template<typename... Args>
std::unique_ptr< IteratorunionOf (Args... args) const
 This allows unionOf(create(...), create(...)) syntax.
 

Detailed Description

Definition at line 133 of file Iterator.h.

Constructor & Destructor Documentation

◆ Corpus()

clang::clangd::dex::Corpus::Corpus ( DocID  Size)
inlineexplicit

Definition at line 137 of file Iterator.h.

Member Function Documentation

◆ all()

std::unique_ptr< Iterator > clang::clangd::dex::Corpus::all ( ) const

Returns TRUE Iterator which iterates over "virtual" PostingList containing all items in range [0, Size) in an efficient manner.

Definition at line 424 of file Iterator.cpp.

Referenced by clang::clangd::dex::Dex::fuzzyFind(), and intersect().

◆ boost()

std::unique_ptr< Iterator > clang::clangd::dex::Corpus::boost ( std::unique_ptr< Iterator Child,
float  Factor 
) const

Returns BOOST iterator which multiplies the score of each item by given factor.

Boosting can be used as a computationally inexpensive filtering. Users can return significantly more items using consumeAndBoost() and then trim Top K using retrieval score.

Definition at line 432 of file Iterator.cpp.

References clang::clangd::dex::Iterator::False.

Referenced by clang::clangd::dex::Dex::fuzzyFind().

◆ intersect() [1/2]

template<typename... Args>
std::unique_ptr< Iterator > clang::clangd::dex::Corpus::intersect ( Args...  args) const
inline

This allows intersect(create(...), create(...)) syntax.

Definition at line 178 of file Iterator.h.

References clang::clangd::Children, intersect(), and clang::clangd::dex::detail::populateChildren().

◆ intersect() [2/2]

std::unique_ptr< Iterator > clang::clangd::dex::Corpus::intersect ( std::vector< std::unique_ptr< Iterator > >  Children) const

Returns AND Iterator which performs the intersection of the PostingLists of its children.

consume(): AND Iterator returns the product of Childrens' boosting scores.

Definition at line 365 of file Iterator.cpp.

References all(), clang::clangd::dex::Iterator::And, clang::clangd::Children, clang::clangd::dex::Iterator::False, and clang::clangd::dex::Iterator::True.

Referenced by clang::clangd::dex::Dex::fuzzyFind(), and intersect().

◆ limit()

std::unique_ptr< Iterator > clang::clangd::dex::Corpus::limit ( std::unique_ptr< Iterator Child,
size_t  Limit 
) const

Returns LIMIT iterator, which yields up to N elements of its child iterator.

Elements only count towards the limit if they are part of the final result set. Therefore the following iterator (AND (2) (LIMIT (1 2) 1)) yields (2), not ().

Definition at line 441 of file Iterator.cpp.

References clang::clangd::dex::Iterator::False.

Referenced by clang::clangd::dex::Dex::fuzzyFind().

◆ none()

std::unique_ptr< Iterator > clang::clangd::dex::Corpus::none ( ) const

Returns FALSE Iterator which iterates over no documents.

Definition at line 428 of file Iterator.cpp.

Referenced by unionOf().

◆ unionOf() [1/2]

template<typename... Args>
std::unique_ptr< Iterator > clang::clangd::dex::Corpus::unionOf ( Args...  args) const
inline

This allows unionOf(create(...), create(...)) syntax.

Definition at line 186 of file Iterator.h.

References clang::clangd::Children, clang::clangd::dex::detail::populateChildren(), and unionOf().

◆ unionOf() [2/2]

std::unique_ptr< Iterator > clang::clangd::dex::Corpus::unionOf ( std::vector< std::unique_ptr< Iterator > >  Children) const

Returns OR Iterator which performs the union of the PostingLists of its children.

consume(): OR Iterator returns the highest boost value among children containing the requested item.

Definition at line 395 of file Iterator.cpp.

References clang::clangd::Children, clang::clangd::dex::Iterator::False, none(), clang::clangd::dex::Iterator::Or, and clang::clangd::dex::Iterator::True.

Referenced by clang::clangd::dex::Dex::fuzzyFind(), and unionOf().


The documentation for this class was generated from the following files: