22 #ifndef XAPIAN_INCLUDED_POSTINGSOURCE_H 23 #define XAPIAN_INCLUDED_POSTINGSOURCE_H 25 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD 26 # error Never use <xapian/postingsource.h> directly; include <xapian.h> instead. 68 : max_weight_(0), matcher_(NULL) { }
128 void set_maxweight(
double max_weight);
146 virtual double get_weight()
const;
171 virtual void next(
double min_wt) = 0;
244 virtual bool at_end()
const = 0;
285 virtual std::string
name()
const;
296 virtual std::string serialise()
const;
312 virtual PostingSource * unserialise(
const std::string &serialised)
const;
332 virtual PostingSource * unserialise_with_registry(
const std::string &serialised,
354 virtual void init(
const Database & db) = 0;
363 virtual std::string get_description()
const;
373 opt_intrusive_base::release();
385 opt_intrusive_base::release();
488 void next(
double min_wt);
514 std::string
get_value()
const {
return *real_value_it; }
541 real_termfreq_min = termfreq_min_;
552 real_termfreq_est = termfreq_est_;
563 real_termfreq_max = termfreq_max_;
595 double get_weight()
const;
597 std::string
name()
const;
598 std::string serialise()
const;
602 std::string get_description()
const;
647 void skip_if_in_range(
double min_wt);
662 double get_weight()
const;
664 std::string
name()
const;
665 std::string serialise()
const;
669 void next(
double min_wt);
673 std::string get_description()
const;
708 void add_mapping(
const std::string &key,
double wt);
711 void clear_mappings();
717 void set_default_weight(
double wt);
719 double get_weight()
const;
721 std::string
name()
const;
722 std::string serialise()
const;
726 std::string get_description()
const;
762 double get_weight()
const;
764 void next(
double min_wt);
773 std::string
name()
const;
774 std::string serialise()
const;
778 std::string get_description()
const;
783 #endif // XAPIAN_INCLUDED_POSTINGSOURCE_H The Xapian namespace contains public interfaces for the Xapian library.
double max_weight_in_map
The maximum weight in weight_map.
This class is used to access a database, or a group of databases.
Xapian::PostingIterator it
Iterator over all documents.
void done()
End the iteration.
A posting source which looks up weights in a map using values as the key.
Compiler attribute macros.
Define XAPIAN_DEPRECATED() and related macros.
Class for iterating over document values.
void set_termfreq_est(Xapian::doccount termfreq_est_)
An estimate of the term frequency.
#define XAPIAN_DEPRECATED(X)
#define XAPIAN_VISIBILITY_DEFAULT
void set_termfreq_max(Xapian::doccount termfreq_max_)
An upper bound on the term frequency.
const PostingSource * release() const
Start reference counting this object.
Read weights from a value which is known to decrease as docid increases.
double max_weight_
The current upper bound on what get_weight() can return.
Class for iterating over a list of terms.
PostingSource()
Allow subclasses to be instantiated.
Xapian::valueno real_slot
std::string get_value() const
Read current value.
ValueIterator valuestream_end(Xapian::valueno) const
Return end iterator corresponding to valuestream_begin().
bool get_started() const
Flag indicating if we've started (true if we have).
void register_matcher_(void *matcher)
Define XAPIAN_VISIBILITY_* macros.
Registry for user subclasses.
Xapian::doccount termfreq
Number of documents in the posting source.
Xapian::doccount real_termfreq_min
bool items_at_end
Flag, set to true if there are docs after the end of the range.
A posting source which returns a fixed weight for all documents.
API for working with Xapian databases.
Xapian::docid range_end
End of range of docids for which weights are known to be decreasing.
Class for iterating over document values.
bool started
Flag indicating if we've started (true if we have).
Base class which provides an "external" source of postings.
std::map< std::string, double > weight_map
The value -> weight map.
Base class for objects managed by opt_intrusive_ptr.
A posting source which generates weights from a value slot.
Xapian::ValueIterator real_value_it
A posting source which reads weights from a value slot.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
unsigned valueno
The number for a value slot in a document.
Xapian::doccount real_termfreq_est
PostingSource * release()
Start reference counting this object.
Xapian::Database db
The database we're reading documents from.
Class for iterating over a list of document ids.
double get_maxweight() const
Return the currently set upper bound on what get_weight() can return.
double default_weight
The default weight.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Xapian::doccount real_termfreq_max
Xapian::docid check_docid
The docid last passed to check() (0 if check() wasn't the last move).
Xapian::docid range_start
Start of range of docids for which weights are known to be decreasing.
double curr_weight
Weight at current position.
void * matcher_
The object to inform of maxweight changes.
Xapian::valueno get_slot() const
The slot we're reading values from.
void set_termfreq_min(Xapian::doccount termfreq_min_)
Set a lower bound on the term frequency.
Xapian::Database get_database() const
The database we're reading values from.