|
xapian-core
2.0.0
|
Class tracking information for a given value of the collapse key. More...
#include <collapser.h>
Collaboration diagram for CollapseData:Public Member Functions | |
| CollapseData (Xapian::doccount item, Xapian::docid did) | |
| Construct with the given item. More... | |
| collapse_result | check_item (const std::vector< Result > &results, const Result &result, Xapian::doccount collapse_max, MSetCmp mcmp, Xapian::doccount &old_item) |
| Check a new result with this collapse key value. More... | |
| void | set_item (Xapian::doccount item) |
| Set item after constructing with a placeholder. More... | |
| void | add_item (const std::vector< Result > &results, Xapian::doccount item, Xapian::doccount collapse_max, MSetCmp mcmp) |
| Complete update of new result with this collapse key value. More... | |
| void | result_has_moved (Xapian::doccount from, Xapian::doccount to) |
| Process relocation of entry in results. 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< std::pair< Xapian::doccount, Xapian::docid > > | items |
| Currently kept MSet entries for this value of the collapse key. More... | |
| double | next_best_weight = 0.0 |
| The highest weight of a document we've rejected. More... | |
| Xapian::doccount | collapse_count = 0 |
| The number of documents we've rejected. More... | |
Class tracking information for a given value of the collapse key.
Definition at line 42 of file collapser.h.
|
inline |
Construct with the given item.
Definition at line 65 of file collapser.h.
| void CollapseData::add_item | ( | const std::vector< Result > & | results, |
| Xapian::doccount | item, | ||
| Xapian::doccount | collapse_max, | ||
| MSetCmp | mcmp | ||
| ) |
Complete update of new result with this collapse key value.
| results | The results so far. |
| item | The new item (index into results). |
| collapse_max | Max no. of items for each collapse key value. |
| mcmp | Result comparison functor. |
Definition at line 106 of file collapser.cc.
References Result::get_docid(), and Heap::replace().
| collapse_result CollapseData::check_item | ( | const std::vector< Result > & | results, |
| const Result & | result, | ||
| Xapian::doccount | collapse_max, | ||
| MSetCmp | mcmp, | ||
| Xapian::doccount & | old_item | ||
| ) |
Check a new result with this collapse key value.
If this method determines the action to take is ADD or REPLACE, then the proto-mset should be updated and then add_item() called to complete the update of the CollapseData (if the result doesn't actually get added, then it's OK not to follow up with a call to add_item()).
| results | The results so far. | |
| result | The new result. | |
| collapse_max | Max no. of items for each collapse key value. | |
| mcmp | Result comparison functor. | |
| [out] | old_item | Item to be replaced (when REPLACE is returned). |
Definition at line 33 of file collapser.cc.
References ADD, Result::get_docid(), Result::get_weight(), Heap::make(), REJECT, Heap::replace(), and REPLACE.
Referenced by Collapser::check().
|
inline |
The number of documents we've rejected.
Definition at line 131 of file collapser.h.
References collapse_count.
|
inline |
The highest weight of a document we've rejected.
Definition at line 128 of file collapser.h.
References next_best_weight.
|
inline |
Process relocation of entry in results.
| from | The old item (index into results). |
| to | The new item (index into results). |
Definition at line 113 of file collapser.h.
Referenced by Collapser::result_has_moved().
| void CollapseData::set_item | ( | Xapian::doccount | item | ) |
Set item after constructing with a placeholder.
| item | The new item (index into results). |
Definition at line 98 of file collapser.cc.
References AssertEq.
|
private |
The number of documents we've rejected.
Definition at line 61 of file collapser.h.
Referenced by get_collapse_count().
|
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.
The first member of the pair is the index into proto_mset.results and the second is the docid of the entry (used to detect if the entry in proto_mset.results we were referring to has been dropped).
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 55 of file collapser.h.
Referenced by result_has_moved().
|
private |
The highest weight of a document we've rejected.
Definition at line 58 of file collapser.h.
Referenced by get_next_best_weight().