xapian-core  1.4.26
Public Member Functions | Private Attributes | List of all members
CollapseData Class Reference

Class tracking information for a given value of the collapse key. More...

#include <collapser.h>

+ Collaboration diagram for CollapseData:

Public Member Functions

 CollapseData (const Xapian::Internal::MSetItem &item)
 Construct with the given MSetItem item. More...
 
collapse_result add_item (const Xapian::Internal::MSetItem &item, Xapian::doccount collapse_max, MSetCmp mcmp, Xapian::Internal::MSetItem &old_item)
 Handle a new MSetItem with this collapse key value. More...
 
double get_next_best_weight () const
 The highest weight of a document we've rejected. More...
 
Xapian::doccount get_collapse_count () const
 The number of documents we've rejected. More...
 

Private Attributes

std::vector< Xapian::Internal::MSetItemitems
 Currently kept MSet entries for this value of the collapse key. More...
 
double next_best_weight
 The highest weight of a document we've rejected. More...
 
Xapian::doccount collapse_count
 The number of documents we've rejected. More...
 

Detailed Description

Class tracking information for a given value of the collapse key.

Definition at line 41 of file collapser.h.

Constructor & Destructor Documentation

◆ CollapseData()

CollapseData::CollapseData ( const Xapian::Internal::MSetItem item)
inlineexplicit

Construct with the given MSetItem item.

Definition at line 60 of file collapser.h.

References add_item().

Member Function Documentation

◆ add_item()

collapse_result CollapseData::add_item ( const Xapian::Internal::MSetItem item,
Xapian::doccount  collapse_max,
MSetCmp  mcmp,
Xapian::Internal::MSetItem old_item 
)

Handle a new MSetItem with this collapse key value.

Parameters
itemThe new item.
collapse_maxMax no. of items for each collapse key value.
mcmpMSetItem comparison functor.
[out]old_itemReplaced item (when REPLACED is returned).
Returns
How item was handled: ADDED, REJECTED or REPLACED.

Definition at line 32 of file collapser.cc.

References ADDED, REJECTED, REPLACED, and Xapian::Internal::MSetItem::wt.

Referenced by CollapseData(), and Collapser::process().

◆ get_collapse_count()

Xapian::doccount CollapseData::get_collapse_count ( ) const
inline

The number of documents we've rejected.

Definition at line 83 of file collapser.h.

References collapse_count.

Referenced by Collapser::operator bool().

◆ get_next_best_weight()

double CollapseData::get_next_best_weight ( ) const
inline

The highest weight of a document we've rejected.

Definition at line 80 of file collapser.h.

References next_best_weight.

Member Data Documentation

◆ collapse_count

Xapian::doccount CollapseData::collapse_count
private

The number of documents we've rejected.

Definition at line 56 of file collapser.h.

Referenced by get_collapse_count().

◆ items

std::vector<Xapian::Internal::MSetItem> CollapseData::items
private

Currently kept MSet entries for this value of the collapse key.

If collapse_max > 1, then this is a min-heap once collapse_count > 0.

FIXME: We expect collapse_max to be small, so perhaps we should preallocate space for that many entries and/or allocate space in larger blocks to divvy up?

Definition at line 50 of file collapser.h.

◆ next_best_weight

double CollapseData::next_best_weight
private

The highest weight of a document we've rejected.

Definition at line 53 of file collapser.h.

Referenced by get_next_best_weight().


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