26 #define XAPIAN_DEPRECATED(X) X 50 PostingSource::~PostingSource() { }
53 PostingSource::set_maxweight(
double max_weight)
55 if (
usual(matcher_)) {
59 max_weight_ = max_weight;
63 PostingSource::get_weight()
const 71 while (!at_end() && get_docid() < did) {
84 PostingSource::clone()
const 96 PostingSource::serialise()
const 102 PostingSource::unserialise(
const string &)
const 108 PostingSource::unserialise_with_registry(
const std::string &s,
111 return unserialise(s);
115 PostingSource::get_description()
const 117 return "Xapian::PostingSource subclass";
125 value_it(real_value_it),
126 started(real_started),
127 termfreq_min(real_termfreq_min),
128 termfreq_est(real_termfreq_est),
129 termfreq_max(real_termfreq_max)
249 return string(
"Xapian::ValueWeightPostingSource");
261 const char * p = s.data();
262 const char * end = p + s.size();
279 if (upper_bound.empty()) {
291 string desc(
"Xapian::ValueWeightPostingSource(slot=");
301 max_weight_in_map(0.0)
339 map<string, double>::const_iterator i;
341 res->add_mapping(i->first, i->second);
344 return res.release();
350 return string(
"Xapian::ValueMapPostingSource");
359 map<string, double>::const_iterator i;
362 result.append(i->first);
372 const char * p = s.data();
373 const char * end = p + s.size();
382 string key(p, keylen);
386 return res.release();
399 string desc(
"Xapian::ValueMapPostingSource(slot=");
514 return string(
"Xapian::FixedWeightPostingSource");
526 const char * p = s.data();
527 const char * s_end = p + s.size();
547 string desc(
"Xapian::FixedWeightPostingSource(wt=");
FixedWeightPostingSource * unserialise(const std::string &serialised) const
Create object given string serialisation returned by serialise().
The Xapian namespace contains public interfaces for the Xapian library.
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
bool check(Xapian::docid min_docid, double min_wt)
Check if the specified docid occurs.
void skip_to(Xapian::docid min_docid, double min_wt)
Advance to the specified docid.
void init(const Database &db_)
Set this PostingSource to the start of the list of postings.
ValueMapPostingSource * clone() const
Clone the posting source.
length encoded as a string
double max_weight_in_map
The maximum weight in weight_map.
std::string serialise() const
Serialise object parameters into a string.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
This class is used to access a database, or a group of databases.
ValueMapPostingSource * unserialise(const std::string &serialised) const
Create object given string serialisation returned by serialise().
void set_maxweight(double max_weight)
Specify an upper bound on what get_weight() will return from now on.
class for performing a match
Xapian::PostingIterator it
Iterator over all documents.
std::string get_description() const
Return a string describing this object.
Xapian::docid get_docid() const
Return the current docid.
A posting source which looks up weights in a map using values as the key.
bool check(Xapian::docid min_docid, double min_wt)
Check if the specified docid occurs.
double get_weight() const
Return the weight contribution for the current document.
std::string name() const
Name of the posting source class.
bool at_end() const
Return true if the current position is past the last entry in this list.
void init(const Database &db_)
Set this PostingSource to the start of the list of postings.
External sources of posting information.
ValueWeightPostingSource(Xapian::valueno slot_)
Construct a ValueWeightPostingSource.
bool & started
Flag indicating if we've started (true if we have).
std::string serialise() const
Serialise object parameters into a string.
Convert types to std::string.
double get_weight() const
Return the weight contribution for the current document.
std::string get_value_upper_bound(Xapian::valueno slot) const
Get an upper bound on the values stored in the given value slot.
std::string encode_length(T len)
Encode a length as a variable-length string.
Xapian::doccount get_doccount() const
Get the number of documents in the database.
void clear_mappings()
Clear all mappings.
std::string serialise() const
Serialise object parameters into a string.
Hierarchy of classes which Xapian can throw as exceptions.
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
functions to serialise and unserialise a double
std::string get_description() const
Return a string describing this object.
Xapian::valueno real_slot
std::string get_value() const
Read current value.
double unserialise_double(const char **p, const char *end)
Unserialise a double serialised by serialise_double.
ValueIterator valuestream_end(Xapian::valueno) const
Return end iterator corresponding to valuestream_begin().
ValueMapPostingSource(Xapian::valueno slot_)
Construct a ValueMapPostingSource.
bool get_started() const
Flag indicating if we've started (true if we have).
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
Registry for user subclasses.
void init(const Database &db_)
Set this PostingSource to the start of the list of postings.
Xapian::doccount termfreq
Number of documents in the posting source.
Xapian::doccount real_termfreq_min
A posting source which returns a fixed weight for all documents.
bool at_end() const
Return true if the current position is past the last entry in this list.
void recalc_maxweight()
Called by postlists to indicate that they've rearranged themselves and the maxweight now possible is ...
string str(int value)
Convert int to std::string.
void skip_to(Xapian::docid min_docid, double min_wt)
Advance to the specified docid.
ValueWeightPostingSource * clone() const
Clone the posting source.
bool started
Flag indicating if we've started (true if we have).
double get_weight() const
Return the weight contribution for the current document.
std::string name() const
Name of the posting source class.
void init(const Database &db_)
Set this PostingSource to the start of the list of postings.
Base class which provides an "external" source of postings.
std::map< std::string, double > weight_map
The value -> weight map.
FixedWeightPostingSource * clone() const
Clone the posting source.
ValueIterator valuestream_begin(Xapian::valueno slot) const
Return an iterator over the value in slot slot for each document.
A posting source which generates weights from a value slot.
double sortable_unserialise(const std::string &serialised)
Convert a string encoded using sortable_serialise back to a floating point number.
bool check(Xapian::docid docid)
Check if the specified docid occurs.
Xapian::ValueIterator real_value_it
A posting source which reads weights from a value slot.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
void set_default_weight(double wt)
Set a default weight for document values not in the map.
std::string serialise_double(double v)
Serialise a double to a string.
void decode_length_and_check(const char **p, const char *end, unsigned &out)
Decode a length encoded by encode_length.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
void add_mapping(const std::string &key, double wt)
Add a mapping.
FixedWeightPostingSource(double wt)
Construct a FixedWeightPostingSource.
Indicates a problem communicating with a remote database.
Xapian::docid get_docid() const
Return the current docid.
void skip_to(Xapian::docid did)
Advance the iterator to document did.
unsigned valueno
The number for a value slot in a document.
Xapian::doccount real_termfreq_est
Xapian::docid get_docid() const
Return the docid at the current position.
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
Xapian::Database db
The database we're reading documents from.
double get_maxweight() const
Return the currently set upper bound on what get_weight() can return.
std::string get_description() const
Return a string describing this object.
double default_weight
The default weight.
void next(double min_wt)
Advance the current position to the next matching document.
Various assertion macros.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
API for working with documents.
PostingIterator postlist_end(const std::string &) const
Corresponding end iterator to postlist_begin().
std::string name() const
Name of the posting source class.
Xapian::doccount real_termfreq_max
Xapian::docid check_docid
The docid last passed to check() (0 if check() wasn't the last move).
void decode_length(const char **p, const char *end, unsigned &out)
Decode a length encoded by encode_length.
ValueWeightPostingSource * unserialise(const std::string &serialised) const
Create object given string serialisation returned by serialise().
Xapian::doccount get_value_freq(Xapian::valueno slot) const
Return the frequency of a given value slot.
Wrapper around standard unique_ptr template.
UnimplementedError indicates an attempt to use an unimplemented feature.
PostingIterator postlist_begin(const std::string &tname) const
An iterator pointing to the start of the postlist for a given term.
parsing a user query string to build a Xapian::Query object
Xapian::valueno get_slot() const
The slot we're reading values from.
void skip_to(Xapian::docid docid_or_slot)
Advance the iterator to document id or value slot docid_or_slot.
Xapian::Database get_database() const
The database we're reading values from.
void next(double min_wt)
Advance the current position to the next matching document.