xapian-core  2.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
HoneyValueManager Class Reference

#include <honey_values.h>

+ Collaboration diagram for HoneyValueManager:

Public Member Functions

 HoneyValueManager (HoneyPostListTable &postlist_table_, HoneyTermListTable &termlist_table_)
 Create a new HoneyValueManager object. More...
 
void merge_changes ()
 
std::string add_document (Xapian::docid did, const Xapian::Document &doc, std::map< Xapian::valueno, ValueStats > &val_stats)
 
void delete_document (Xapian::docid did, std::map< Xapian::valueno, ValueStats > &val_stats)
 
std::string replace_document (Xapian::docid did, const Xapian::Document &doc, std::map< Xapian::valueno, ValueStats > &val_stats)
 
std::string get_value (Xapian::docid did, Xapian::valueno slot) const
 
void get_all_values (std::map< Xapian::valueno, std::string > &values, Xapian::docid did) const
 
Xapian::doccount get_value_freq (Xapian::valueno slot) const
 
std::string get_value_lower_bound (Xapian::valueno slot) const
 
std::string get_value_upper_bound (Xapian::valueno slot) const
 
void set_value_stats (std::map< Xapian::valueno, ValueStats > &val_stats)
 Write the updated statistics to the table. More...
 
void reset ()
 
bool is_modified () const
 
void cancel ()
 

Private Member Functions

void add_value (Xapian::docid did, Xapian::valueno slot, const std::string &val)
 
void remove_value (Xapian::docid did, Xapian::valueno slot)
 
Xapian::docid get_chunk_containing_did (Xapian::valueno slot, Xapian::docid did, std::string &chunk) const
 Move the cursor to the chunk containing did. More...
 
void get_value_stats (Xapian::valueno slot) const
 Get the statistics for value slot slot. More...
 
void get_value_stats (Xapian::valueno slot, ValueStats &stats) const
 

Private Attributes

Xapian::valueno mru_slot = Xapian::BAD_VALUENO
 The value number for the most recently used value statistics. More...
 
ValueStats mru_valstats
 The most recently used value statistics. More...
 
HoneyPostListTablepostlist_table
 
HoneyTermListTabletermlist_table
 
std::map< Xapian::docid, std::string > slots
 
std::map< Xapian::valueno, std::map< Xapian::docid, std::string > > changes
 
std::unique_ptr< HoneyCursorcursor
 

Detailed Description

Definition at line 120 of file honey_values.h.

Constructor & Destructor Documentation

◆ HoneyValueManager()

HoneyValueManager::HoneyValueManager ( HoneyPostListTable postlist_table_,
HoneyTermListTable termlist_table_ 
)
inline

Create a new HoneyValueManager object.

Definition at line 161 of file honey_values.h.

Member Function Documentation

◆ add_document()

string HoneyValueManager::add_document ( Xapian::docid  did,
const Xapian::Document doc,
std::map< Xapian::valueno, ValueStats > &  val_stats 
)

◆ add_value()

void HoneyValueManager::add_value ( Xapian::docid  did,
Xapian::valueno  slot,
const std::string &  val 
)
private

Definition at line 120 of file honey_values.cc.

◆ cancel()

void HoneyValueManager::cancel ( )
inline

Definition at line 217 of file honey_values.h.

References changes, and slots.

◆ delete_document()

void HoneyValueManager::delete_document ( Xapian::docid  did,
std::map< Xapian::valueno, ValueStats > &  val_stats 
)

◆ get_all_values()

void HoneyValueManager::get_all_values ( std::map< Xapian::valueno, std::string > &  values,
Xapian::docid  did 
) const

◆ get_chunk_containing_did()

Xapian::docid HoneyValueManager::get_chunk_containing_did ( Xapian::valueno  slot,
Xapian::docid  did,
std::string &  chunk 
) const
private

Move the cursor to the chunk containing did.

Returns
The last docid in the chunk, or 0 if off the end of the stream.

Definition at line 141 of file honey_values.cc.

References Honey::docid_from_key(), LOGCALL, Honey::make_valuechunk_key(), and RETURN.

◆ get_value()

string HoneyValueManager::get_value ( Xapian::docid  did,
Xapian::valueno  slot 
) const

◆ get_value_freq()

Xapian::doccount HoneyValueManager::get_value_freq ( Xapian::valueno  slot) const
inline

Definition at line 184 of file honey_values.h.

References ValueStats::freq, get_value_stats(), mru_slot, and mru_valstats.

Referenced by HoneyDatabase::get_value_freq().

◆ get_value_lower_bound()

std::string HoneyValueManager::get_value_lower_bound ( Xapian::valueno  slot) const
inline

◆ get_value_stats() [1/2]

void HoneyValueManager::get_value_stats ( Xapian::valueno  slot) const
private

Get the statistics for value slot slot.

Definition at line 586 of file honey_values.cc.

References Xapian::BAD_VALUENO, and LOGCALL_VOID.

Referenced by get_value_freq(), get_value_lower_bound(), and get_value_upper_bound().

◆ get_value_stats() [2/2]

void HoneyValueManager::get_value_stats ( Xapian::valueno  slot,
ValueStats stats 
) const
private

◆ get_value_upper_bound()

std::string HoneyValueManager::get_value_upper_bound ( Xapian::valueno  slot) const
inline

◆ is_modified()

bool HoneyValueManager::is_modified ( ) const
inline

Definition at line 213 of file honey_values.h.

References changes.

◆ merge_changes()

void HoneyValueManager::merge_changes ( )

Definition at line 306 of file honey_values.cc.

References Honey::ValueUpdater::update().

◆ remove_value()

void HoneyValueManager::remove_value ( Xapian::docid  did,
Xapian::valueno  slot 
)
private

Definition at line 131 of file honey_values.cc.

◆ replace_document()

string HoneyValueManager::replace_document ( Xapian::docid  did,
const Xapian::Document doc,
std::map< Xapian::valueno, ValueStats > &  val_stats 
)

Definition at line 476 of file honey_values.cc.

References Xapian::Document::get_docid(), and Xapian::Document::internal.

◆ reset()

void HoneyValueManager::reset ( )
inline

Ignore any old cached valuestats.

Definition at line 208 of file honey_values.h.

References Xapian::BAD_VALUENO, and mru_slot.

◆ set_value_stats()

void HoneyValueManager::set_value_stats ( std::map< Xapian::valueno, ValueStats > &  val_stats)

Write the updated statistics to the table.

If the freq member of the statistics for a particular slot is 0, the statistics for that slot will be cleared.

Parameters
val_statsThe statistics to set.

Definition at line 634 of file honey_values.cc.

References Xapian::BAD_VALUENO, ValueStats::clear(), Honey::encode_valuestats(), ValueStats::freq, LOGCALL_VOID, ValueStats::lower_bound, Honey::make_valuestats_key(), and ValueStats::upper_bound.

Member Data Documentation

◆ changes

std::map<Xapian::valueno, std::map<Xapian::docid, std::string> > HoneyValueManager::changes
private

Definition at line 137 of file honey_values.h.

Referenced by cancel(), and is_modified().

◆ cursor

std::unique_ptr<HoneyCursor> HoneyValueManager::cursor
mutableprivate

Definition at line 139 of file honey_values.h.

◆ mru_slot

Xapian::valueno HoneyValueManager::mru_slot = Xapian::BAD_VALUENO
mutableprivate

The value number for the most recently used value statistics.

Set to Xapian::BAD_VALUENO if no value statistics are currently cached.

Definition at line 126 of file honey_values.h.

Referenced by get_value_freq(), get_value_lower_bound(), get_value_upper_bound(), and reset().

◆ mru_valstats

ValueStats HoneyValueManager::mru_valstats
mutableprivate

The most recently used value statistics.

Definition at line 129 of file honey_values.h.

Referenced by get_value_freq(), get_value_lower_bound(), and get_value_upper_bound().

◆ postlist_table

HoneyPostListTable& HoneyValueManager::postlist_table
private

Definition at line 131 of file honey_values.h.

◆ slots

std::map<Xapian::docid, std::string> HoneyValueManager::slots
private

Definition at line 135 of file honey_values.h.

Referenced by cancel().

◆ termlist_table

HoneyTermListTable& HoneyValueManager::termlist_table
private

Definition at line 133 of file honey_values.h.


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