|
xapian-core
2.0.0
|
Metadata for a term in a document. More...
#include <terminfo.h>
Collaboration diagram for TermInfo:Public Member Functions | |
| TermInfo (Xapian::termcount wdf_) | |
| Constructor. More... | |
| TermInfo (Xapian::termcount wdf_, Xapian::termpos termpos) | |
| Constructor which also adds an initial position. More... | |
| const Xapian::VecCOW< Xapian::termpos > * | get_positions () const |
| Get a pointer to the positions. More... | |
| bool | has_positions () const |
| size_t | count_positions () const |
| Xapian::termcount | get_wdf () const |
| Get the within-document frequency. More... | |
| bool | increase_wdf (Xapian::termcount delta) |
| Increase within-document frequency. More... | |
| bool | decrease_wdf (Xapian::termcount delta) |
| Decrease within-document frequency. More... | |
| bool | remove () |
| bool | add_position (Xapian::termcount wdf_inc, Xapian::termpos termpos) |
| Add a position. More... | |
| void | append_position (Xapian::termpos termpos) |
| Append a position. More... | |
| bool | remove_position (Xapian::termpos termpos) |
| Remove a position. More... | |
| Xapian::termpos | remove_positions (Xapian::termpos termpos_first, Xapian::termpos termpos_last) |
| Remove a range of positions. More... | |
| bool | is_deleted () const |
| Has this term been deleted from this document? More... | |
Private Member Functions | |
| void | merge () const |
| Merge sorted ranges before and after split. More... | |
Private Attributes | |
| Xapian::termcount | wdf |
| unsigned | split = 0 |
| Split point in the position range. More... | |
| Xapian::VecCOW< Xapian::termpos > | positions |
| Positions at which the term occurs. More... | |
Metadata for a term in a document.
Definition at line 28 of file terminfo.h.
|
inlineexplicit |
|
inline |
Constructor which also adds an initial position.
| wdf_ | Within-document frequency |
| termpos | Position to add |
Definition at line 72 of file terminfo.h.
References positions.
| bool TermInfo::add_position | ( | Xapian::termcount | wdf_inc, |
| Xapian::termpos | termpos | ||
| ) |
Add a position.
If termpos is already present, this is a no-op.
| wdf_inc | wdf increment |
| termpos | Position to add |
Definition at line 43 of file terminfo.cc.
|
inline |
Append a position.
The position must be >= the largest currently in the list.
Definition at line 145 of file terminfo.h.
References positions.
|
inline |
Definition at line 84 of file terminfo.h.
References positions.
|
inline |
Decrease within-document frequency.
Definition at line 107 of file terminfo.h.
|
inline |
Get a pointer to the positions.
Definition at line 77 of file terminfo.h.
|
inline |
|
inline |
Definition at line 82 of file terminfo.h.
References positions.
|
inline |
Increase within-document frequency.
Definition at line 93 of file terminfo.h.
References is_deleted(), rare, split, and wdf.
|
inline |
Has this term been deleted from this document?
We flag entries as deleted instead of actually deleting them to avoid invalidating existing TermIterator objects.
Definition at line 174 of file terminfo.h.
References positions, and split.
Referenced by increase_wdf(), and remove().
|
private |
Merge sorted ranges before and after split.
Definition at line 33 of file terminfo.cc.
References Assert.
Referenced by get_positions().
|
inline |
Definition at line 122 of file terminfo.h.
References is_deleted(), positions, and split.
| bool TermInfo::remove_position | ( | Xapian::termpos | termpos | ) |
Remove a position.
| termpos | Position to remove |
Definition at line 110 of file terminfo.cc.
| Xapian::termpos TermInfo::remove_positions | ( | Xapian::termpos | termpos_first, |
| Xapian::termpos | termpos_last | ||
| ) |
Remove a range of positions.
| termpos_first | First position to remove |
| termpos_last | Last position to remove |
It's OK if there are no positions in the specified range.
Definition at line 145 of file terminfo.cc.
References Assert.
|
mutableprivate |
Positions at which the term occurs.
The entries are sorted in strictly increasing order (so duplicate entries are not allowed).
Definition at line 55 of file terminfo.h.
Referenced by append_position(), count_positions(), decrease_wdf(), get_positions(), has_positions(), is_deleted(), remove(), and TermInfo().
|
mutableprivate |
Split point in the position range.
To allow more efficient insertion of positions, we support the positions being split into two sorted ranges, and if this is the case, split will be > 0 and there will be two sorted ranges [0, split) and [split, positions.size()).
If split is 0, then [0, positions.size()) form a single sorted range.
If positions.empty(), then split > 0 indicates that the term has been deleted (this allows us to delete terms without invalidating existing TermIterator objects).
Use type unsigned here to avoid bloating this structure. More than 4 billion positions in one document is not sensible (and not possible unless termpos is configured to be 64 bit).
Definition at line 48 of file terminfo.h.
Referenced by decrease_wdf(), get_positions(), increase_wdf(), is_deleted(), and remove().
|
private |
Definition at line 29 of file terminfo.h.
Referenced by decrease_wdf(), get_wdf(), and increase_wdf().