xapian-core  1.4.27
Public Member Functions | Public Attributes | Private Attributes | List of all members
Collapser Class Reference

The Collapser class tracks collapse keys and the documents they match. More...

#include <collapser.h>

+ Collaboration diagram for Collapser:

Public Member Functions

 Collapser (Xapian::valueno slot_, Xapian::doccount collapse_max_)
 
 operator bool () const
 Return true if collapsing is active for this match. More...
 
collapse_result process (Xapian::Internal::MSetItem &item, PostList *postlist, Xapian::Document::Internal &vsdoc, MSetCmp mcmp)
 Handle a new MSetItem. More...
 
Xapian::doccount get_collapse_count (const std::string &collapse_key, int percent_cutoff, double min_weight) const
 
Xapian::doccount get_docs_considered () const
 
Xapian::doccount get_dups_ignored () const
 
Xapian::doccount entries () const
 
Xapian::doccount get_matches_lower_bound () const
 
bool empty () const
 

Public Attributes

Xapian::Internal::MSetItem old_item
 Replaced item when REPLACED is returned by collapse(). More...
 

Private Attributes

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

Detailed Description

The Collapser class tracks collapse keys and the documents they match.

Definition at line 87 of file collapser.h.

Constructor & Destructor Documentation

◆ Collapser()

Collapser::Collapser ( Xapian::valueno  slot_,
Xapian::doccount  collapse_max_ 
)
inline

Definition at line 124 of file collapser.h.

Member Function Documentation

◆ empty()

bool Collapser::empty ( ) const
inline

Definition at line 159 of file collapser.h.

Referenced by MultiMatch::get_mset().

◆ entries()

Xapian::doccount Collapser::entries ( ) const
inline

Definition at line 155 of file collapser.h.

Referenced by MultiMatch::get_mset().

◆ get_collapse_count()

Xapian::doccount Collapser::get_collapse_count ( const std::string &  collapse_key,
int  percent_cutoff,
double  min_weight 
) const

Definition at line 111 of file collapser.cc.

References Assert.

Referenced by MultiMatch::get_mset().

◆ get_docs_considered()

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

Definition at line 151 of file collapser.h.

Referenced by MultiMatch::get_mset().

◆ get_dups_ignored()

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

Definition at line 153 of file collapser.h.

Referenced by MultiMatch::get_mset().

◆ get_matches_lower_bound()

Xapian::doccount Collapser::get_matches_lower_bound ( ) const

Definition at line 137 of file collapser.cc.

Referenced by MultiMatch::get_mset().

◆ operator bool()

Collapser::operator bool ( ) const
inline

Return true if collapsing is active for this match.

Definition at line 130 of file collapser.h.

References CollapseData::get_collapse_count().

◆ process()

collapse_result Collapser::process ( Xapian::Internal::MSetItem item,
PostList postlist,
Xapian::Document::Internal vsdoc,
MSetCmp  mcmp 
)

Handle a new MSetItem.

Parameters
itemThe new item.
postlistPostList to try to get collapse key from (this happens for a remote match).
docDocument for getting values.
mcmpMSetItem comparison functor.
Returns
How item was handled: EMPTY, ADDED, REJECTED or REPLACED.

Definition at line 70 of file collapser.cc.

References CollapseData::add_item(), ADDED, Xapian::Internal::MSetItem::collapse_key, EMPTY, Xapian::PostingIterator::Internal::get_collapse_key(), Xapian::Document::Internal::get_value(), REJECTED, and REPLACED.

Referenced by MultiMatch::get_mset().

Member Data Documentation

◆ collapse_max

Xapian::doccount Collapser::collapse_max
private

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

Definition at line 118 of file collapser.h.

◆ docs_considered

Xapian::doccount Collapser::docs_considered
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 112 of file collapser.h.

◆ dups_ignored

Xapian::doccount Collapser::dups_ignored
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 105 of file collapser.h.

◆ entry_count

Xapian::doccount Collapser::entry_count
private

How many items we're currently keeping in table.

Definition at line 92 of file collapser.h.

◆ no_collapse_key

Xapian::doccount Collapser::no_collapse_key
private

How many documents have we seen without a collapse key?

We use this statistic to improve matches_lower_bound.

Definition at line 98 of file collapser.h.

◆ old_item

Xapian::Internal::MSetItem Collapser::old_item

Replaced item when REPLACED is returned by collapse().

Definition at line 122 of file collapser.h.

Referenced by MultiMatch::get_mset().

◆ slot

Xapian::valueno Collapser::slot
private

The value slot we're getting collapse keys from.

Definition at line 115 of file collapser.h.

◆ table

std::map<std::string, CollapseData> Collapser::table
private

Map from collapse key values to the items we're keeping for them.

Definition at line 89 of file collapser.h.


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