Collapser Class Reference

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

#include <collapser.h>

Collaboration diagram for Collapser:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Collapser (Xapian::valueno slot_, Xapian::doccount collapse_max_)
 operator bool () const
 Return true if collapsing is active for this match.
collapse_result process (Xapian::Internal::MSetItem &item, PostList *postlist, Xapian::Document::Internal &vsdoc, const MSetCmp &mcmp)
 Handle a new MSetItem.
Xapian::doccount get_collapse_count (const std::string &collapse_key, int percent_cutoff, Xapian::weight 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().

Private Attributes

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


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 ( Xapian::valueno  slot_,
Xapian::doccount  collapse_max_ 
) [inline]

Definition at line 124 of file collapser.h.


Member Function Documentation

bool Collapser::empty (  )  const [inline]

Definition at line 159 of file collapser.h.

References table.

Referenced by MultiMatch::get_mset().

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

Definition at line 155 of file collapser.h.

References entry_count.

Referenced by MultiMatch::get_mset().

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

Definition at line 112 of file collapser.cc.

References Assert, and table.

Referenced by MultiMatch::get_mset().

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

Definition at line 151 of file collapser.h.

References docs_considered.

Referenced by MultiMatch::get_mset().

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

Definition at line 153 of file collapser.h.

References dups_ignored.

Referenced by MultiMatch::get_mset().

Xapian::doccount Collapser::get_matches_lower_bound (  )  const

Definition at line 138 of file collapser.cc.

References collapse_max, entry_count, no_collapse_key, and table.

Referenced by MultiMatch::get_mset().

Collapser::operator bool (  )  const [inline]

Return true if collapsing is active for this match.

Definition at line 130 of file collapser.h.

References collapse_max.

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

Handle a new MSetItem.

Parameters:
item The new item.
postlist PostList to try to get collapse key from (this happens for a remote match).
doc Document for getting values.
mcmp MSetItem 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, collapse_max, docs_considered, dups_ignored, EMPTY, entry_count, Xapian::PostingIterator::Internal::get_collapse_key(), Xapian::Document::Internal::get_value(), no_collapse_key, old_item, REJECTED, REPLACED, slot, and table.

Referenced by MultiMatch::get_mset().


Member Data Documentation

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

Definition at line 118 of file collapser.h.

Referenced by get_matches_lower_bound(), operator bool(), and process().

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.

Referenced by get_docs_considered(), and process().

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.

Referenced by get_dups_ignored(), and process().

How many items we're currently keeping in table.

Definition at line 92 of file collapser.h.

Referenced by entries(), get_matches_lower_bound(), and process().

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.

Referenced by get_matches_lower_bound(), and process().

Replaced item when REPLACED is returned by collapse().

Definition at line 122 of file collapser.h.

Referenced by MultiMatch::get_mset(), and process().

The value slot we're getting collapse keys from.

Definition at line 115 of file collapser.h.

Referenced by process().

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.

Referenced by empty(), get_collapse_count(), get_matches_lower_bound(), and process().


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

Documentation for Xapian (version 1.2.9).
Generated on 10 May 2012 by Doxygen 1.5.9.