|
xapian-core
2.0.0
|
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_, std::vector< Result > &results_, MSetCmp mcmp_) | |
| operator bool () const | |
| Return true if collapsing is active for this match. More... | |
| collapse_result | check (Result &result, Xapian::Document::Internal &vsdoc) |
| Check a new result. More... | |
| void | process (collapse_result action, Xapian::doccount item) |
| Handle a new Result. More... | |
| void | result_has_moved (Xapian::doccount from, Xapian::doccount to) |
| Process relocation of entry in results. More... | |
| Xapian::doccount | get_collapse_count (const std::string &collapse_key, int percent_threshold, double min_weight) const |
| 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 (double min_weight, int percent_threshold) |
Public Attributes | |
| Xapian::doccount | old_item = 0 |
| Replaced item when REPLACE is returned by collapse(). More... | |
Private Member Functions | |
| bool | operator() (Xapian::doccount a, Xapian::doccount b) const |
| Adapt mcmp to be usable with min_heap. More... | |
Private Attributes | |
| std::unordered_map< std::string, CollapseData > | table |
| Map from collapse key values to the items we're keeping for them. 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::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... | |
| std::vector< Result > & | results |
| MSetCmp | mcmp |
| CollapseData * | ptr = NULL |
| Pointer to CollapseData when NEW or ADD is in progress. More... | |
The Collapser class tracks collapse keys and the documents they match.
Definition at line 135 of file collapser.h.
|
inline |
Definition at line 184 of file collapser.h.
| collapse_result Collapser::check | ( | Result & | result, |
| Xapian::Document::Internal & | vsdoc | ||
| ) |
Check a new result.
If this method determines the action to take is NEW or ADD then the proto-mset should be updated and then process() called to complete the update (if the result doesn't actually get added, then it's OK not to follow up with a call to process()).
| result | The new result. |
| vsdoc | Document for getting values. |
Definition at line 126 of file collapser.cc.
References ADD, CollapseData::check_item(), EMPTY, Result::get_collapse_key(), Result::get_docid(), Xapian::Document::Internal::get_value(), NEW, REJECT, REPLACE, and Result::set_collapse_key().
Referenced by ProtoMSet::process().
| void Collapser::finalise | ( | double | min_weight, |
| int | percent_threshold | ||
| ) |
Definition at line 237 of file collapser.cc.
Referenced by ProtoMSet::finalise().
| Xapian::doccount Collapser::get_collapse_count | ( | const std::string & | collapse_key, |
| int | percent_threshold, | ||
| double | min_weight | ||
| ) | const |
Definition at line 185 of file collapser.cc.
References Assert.
|
inline |
Definition at line 243 of file collapser.h.
References docs_considered.
Referenced by ProtoMSet::finalise().
|
inline |
Definition at line 245 of file collapser.h.
References dups_ignored.
Referenced by ProtoMSet::finalise().
|
inline |
Definition at line 247 of file collapser.h.
References entry_count.
| Xapian::doccount Collapser::get_matches_lower_bound | ( | ) | const |
Definition at line 212 of file collapser.cc.
Referenced by ProtoMSet::finalise().
|
inline |
Return true if collapsing is active for this match.
Definition at line 194 of file collapser.h.
References collapse_max.
|
inlineprivate |
Adapt mcmp to be usable with min_heap.
Definition at line 176 of file collapser.h.
| void Collapser::process | ( | collapse_result | action, |
| Xapian::doccount | item | ||
| ) |
Handle a new Result.
| action | The collapse_result returned by check(). |
| item | The new item (index into results). |
Definition at line 164 of file collapser.cc.
References ADD, Assert, and NEW.
Referenced by ProtoMSet::process().
|
inline |
Process relocation of entry in results.
| from | The old item (index into results). |
| to | The new item (index into results). |
Definition at line 223 of file collapser.h.
References Assert, rare, CollapseData::result_has_moved(), results, and table.
Referenced by ProtoMSet::handle_min_weight_pending().
|
private |
The maximum number of items to keep for each collapse key value.
Definition at line 166 of file collapser.h.
Referenced by operator bool().
|
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 160 of file collapser.h.
Referenced by get_docs_considered().
|
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 153 of file collapser.h.
Referenced by get_dups_ignored().
|
private |
How many items we're currently keeping in table.
Definition at line 140 of file collapser.h.
Referenced by get_entries().
|
private |
Definition at line 170 of file collapser.h.
Referenced by operator()().
|
private |
How many documents have we seen without a collapse key?
We use this statistic to improve matches_lower_bound.
Definition at line 146 of file collapser.h.
| Xapian::doccount Collapser::old_item = 0 |
Replaced item when REPLACE is returned by collapse().
Definition at line 182 of file collapser.h.
Referenced by ProtoMSet::process().
|
private |
Pointer to CollapseData when NEW or ADD is in progress.
Definition at line 173 of file collapser.h.
|
private |
Definition at line 168 of file collapser.h.
Referenced by operator()(), and result_has_moved().
|
private |
The value slot we're getting collapse keys from.
Definition at line 163 of file collapser.h.
|
private |
Map from collapse key values to the items we're keeping for them.
Definition at line 137 of file collapser.h.
Referenced by result_has_moved().