xapian-core  2.0.0
Public Member Functions | Private Attributes | List of all members
CollapserLite Class Reference

Simpler version of Collapser used when merging MSet objects. More...

#include <collapser.h>

+ Collaboration diagram for CollapserLite:

Public Member Functions

 CollapserLite (Xapian::doccount collapse_max_)
 
 operator bool () const
 Return true if collapsing is active for this match. More...
 
bool add (const std::string &key)
 Try to add a new key. More...
 
Xapian::doccount get_docs_considered () const
 
Xapian::doccount get_dups_ignored () const
 
Xapian::doccount get_entries () const
 
Xapian::doccount get_matches_lower_bound () const
 
void finalise (std::vector< Result > &results, int percent_threshold)
 

Private Attributes

std::unordered_map< std::string, Xapian::doccounttable
 Map from collapse key values to collapse counts. More...
 
Xapian::doccount entry_count = 0
 How many items we're currently keeping in table. More...
 
Xapian::doccount no_collapse_key = 0
 How many documents have we seen without a collapse key? More...
 
Xapian::doccount dups_ignored = 0
 How many documents with duplicate collapse keys we have ignored. More...
 
Xapian::doccount docs_considered = 0
 How many documents we've considered for collapsing. More...
 
Xapian::doccount collapse_max
 The maximum number of items to keep for each collapse key value. More...
 

Detailed Description

Simpler version of Collapser used when merging MSet objects.

We merge results in descending rank order, so collapsing is much simpler than during the match - we just need to discard documents if we've already seen collapse_max with the same key.

Definition at line 260 of file collapser.h.

Constructor & Destructor Documentation

◆ CollapserLite()

CollapserLite::CollapserLite ( Xapian::doccount  collapse_max_)
inline

Definition at line 291 of file collapser.h.

Member Function Documentation

◆ add()

bool CollapserLite::add ( const std::string &  key)
inline

Try to add a new key.

Returns
true if accepted; false if rejected.

Definition at line 301 of file collapser.h.

References collapse_max, docs_considered, dups_ignored, entry_count, no_collapse_key, and table.

◆ finalise()

void CollapserLite::finalise ( std::vector< Result > &  results,
int  percent_threshold 
)
inline

Definition at line 334 of file collapser.h.

References entry_count, and table.

◆ get_docs_considered()

Xapian::doccount CollapserLite::get_docs_considered ( ) const
inline

Definition at line 324 of file collapser.h.

References docs_considered.

◆ get_dups_ignored()

Xapian::doccount CollapserLite::get_dups_ignored ( ) const
inline

Definition at line 326 of file collapser.h.

References dups_ignored.

◆ get_entries()

Xapian::doccount CollapserLite::get_entries ( ) const
inline

Definition at line 328 of file collapser.h.

References entry_count.

◆ get_matches_lower_bound()

Xapian::doccount CollapserLite::get_matches_lower_bound ( ) const
inline

Definition at line 330 of file collapser.h.

References entry_count, and no_collapse_key.

◆ operator bool()

CollapserLite::operator bool ( ) const
inline

Return true if collapsing is active for this match.

Definition at line 295 of file collapser.h.

References collapse_max.

Member Data Documentation

◆ collapse_max

Xapian::doccount CollapserLite::collapse_max
private

The maximum number of items to keep for each collapse key value.

Definition at line 288 of file collapser.h.

Referenced by add(), and operator bool().

◆ docs_considered

Xapian::doccount CollapserLite::docs_considered = 0
private

How many documents we've considered for collapsing.

We use this statistic to improve matches_estimated (by considering the rate of collapsing).

Definition at line 285 of file collapser.h.

Referenced by add(), and get_docs_considered().

◆ dups_ignored

Xapian::doccount CollapserLite::dups_ignored = 0
private

How many documents with duplicate collapse keys we have ignored.

We use this statistic to improve matches_estimated (by considering the rate of collapsing) and matches_upper_bound.

Definition at line 278 of file collapser.h.

Referenced by add(), and get_dups_ignored().

◆ entry_count

Xapian::doccount CollapserLite::entry_count = 0
private

How many items we're currently keeping in table.

Definition at line 265 of file collapser.h.

Referenced by add(), finalise(), get_entries(), and get_matches_lower_bound().

◆ no_collapse_key

Xapian::doccount CollapserLite::no_collapse_key = 0
private

How many documents have we seen without a collapse key?

We use this statistic to improve matches_lower_bound.

Definition at line 271 of file collapser.h.

Referenced by add(), and get_matches_lower_bound().

◆ table

std::unordered_map<std::string, Xapian::doccount> CollapserLite::table
private

Map from collapse key values to collapse counts.

Definition at line 262 of file collapser.h.

Referenced by add(), and finalise().


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