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;
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,
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;
Compiler attribute macros.
This class is used to access a database, or a group of databases.
ValueIterator valuestream_end(Xapian::valueno) const
Return end iterator corresponding to valuestream_begin().
Read weights from a value which is known to decrease as docid increases.
Xapian::docid range_end
End of range of docids for which weights are known to be decreasing.
double curr_weight
Weight at current position.
Xapian::docid range_start
Start of range of docids for which weights are known to be decreasing.
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.
Xapian::PostingIterator it
Iterator over all documents.
bool started
Flag indicating if we've started (true if we have).
Xapian::docid check_docid
The docid last passed to check() (0 if check() wasn't the last move).
Xapian::doccount termfreq
Number of documents in the posting source.
Xapian::Database db
The database we're reading documents from.
Base class for objects managed by opt_intrusive_ptr.
Class for iterating over a list of terms.
Base class which provides an "external" source of postings.
void * matcher_
The object to inform of maxweight changes.
virtual Xapian::doccount get_termfreq_est() const =0
An estimate of the number of documents this object can return.
void operator=(const PostingSource &)
Don't allow assignment.
virtual void next(double min_wt)=0
Advance the current position to the next matching document.
const PostingSource * release() const
Start reference counting this object.
virtual Xapian::doccount get_termfreq_max() const =0
An upper bound on the number of documents this object can return.
double get_maxweight() const
Return the currently set upper bound on what get_weight() can return.
PostingSource * release()
Start reference counting this object.
virtual Xapian::doccount get_termfreq_min() const =0
A lower bound on the number of documents this object can return.
PostingSource(const PostingSource &)
Don't allow copying.
virtual Xapian::docid get_docid() const =0
Return the current docid.
virtual void init(const Database &db)=0
Set this PostingSource to the start of the list of postings.
PostingSource()
Allow subclasses to be instantiated.
virtual bool at_end() const =0
Return true if the current position is past the last entry in this list.
double max_weight_
The current upper bound on what get_weight() can return.
void register_matcher_(void *matcher)
Registry for user subclasses.
Class for iterating over document values.
A posting source which looks up weights in a map using values as the key.
std::map< std::string, double > weight_map
The value -> weight map.
double max_weight_in_map
The maximum weight in weight_map.
double default_weight
The default weight.
A posting source which generates weights from a value slot.
Xapian::doccount real_termfreq_min
void set_termfreq_min(Xapian::doccount termfreq_min_)
Set a lower bound on the term frequency.
Xapian::ValueIterator real_value_it
Xapian::valueno real_slot
Xapian::Database get_database() const
The database we're reading values from.
void set_termfreq_est(Xapian::doccount termfreq_est_)
An estimate of the term frequency.
bool get_started() const
Flag indicating if we've started (true if we have).
void set_termfreq_max(Xapian::doccount termfreq_max_)
An upper bound on the term frequency.
std::string get_value() const
Read current value.
Xapian::doccount real_termfreq_max
Xapian::doccount real_termfreq_est
Xapian::valueno get_slot() const
The slot we're reading values from.
void done()
End the iteration.
A posting source which reads weights from a value slot.
Define XAPIAN_DEPRECATED() and related macros.
API for working with Xapian databases.
The Xapian namespace contains public interfaces for the Xapian library.
unsigned valueno
The number for a value slot in a document.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Class for iterating over a list of document ids.
#define XAPIAN_DEPRECATED(X)
Class for iterating over document values.
Define XAPIAN_VISIBILITY_* macros.
#define XAPIAN_VISIBILITY_DEFAULT