22 #ifndef XAPIAN_INCLUDED_MSET_H
23 #define XAPIAN_INCLUDED_MSET_H
25 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD
26 # error Never use <xapian/mset.h> directly; include <xapian.h> instead.
68 #ifdef XAPIAN_MOVE_SEMANTICS
96 int convert_to_percent(
double weight)
const;
126 double get_termweight(
const std::string & term)
const;
161 double get_max_attained()
const;
163 double get_max_possible()
const;
172 SNIPPET_BACKGROUND_MODEL = 1,
179 SNIPPET_EXHAUSTIVE = 2,
186 SNIPPET_EMPTY_WITHOUT_MATCH = 4,
211 SNIPPET_NGRAMS = 2048,
220 SNIPPET_CJK_NGRAM = SNIPPET_NGRAMS
252 std::string snippet(
const std::string & text,
255 unsigned flags = SNIPPET_BACKGROUND_MODEL|SNIPPET_EXHAUSTIVE,
256 const std::string & hi_start =
"<b>",
257 const std::string & hi_end =
"</b>",
258 const std::string & omit =
"...")
const;
300 bool empty()
const {
return size() == 0; }
318 std::string get_description()
const;
372 : mset(mset_), off_from_end(off_from_end_) { }
485 double get_weight()
const;
491 std::string get_collapse_key()
const;
518 std::string get_sort_key()
const;
536 std::string get_description()
const;
540 XAPIAN_NOTHROW(
operator==(
const MSetIterator &a,
const MSetIterator &b));
546 return a.off_from_end == b.off_from_end;
550 XAPIAN_NOTHROW(
operator!=(
const MSetIterator &a,
const MSetIterator &b));
560 XAPIAN_NOTHROW(
operator<(
const MSetIterator &a,
const MSetIterator &b));
566 return a.off_from_end > b.off_from_end;
570 XAPIAN_NOTHROW(
operator>(
const MSetIterator &a,
const MSetIterator &b));
580 XAPIAN_NOTHROW(
operator>=(
const MSetIterator &a,
const MSetIterator &b));
590 XAPIAN_NOTHROW(
operator<=(
const MSetIterator &a,
const MSetIterator &b));
Compiler attribute macros.
A handle representing a document in a Xapian database.
A smart pointer that uses intrusive reference counting.
Iterator over a Xapian::MSet.
MSetIterator operator-(difference_type n) const
Return the iterator decremented by n positions.
MSetIterator & operator+=(difference_type n)
Move the iterator forwards by n positions.
MSetIterator()
Create an unpositioned MSetIterator.
std::random_access_iterator_tag iterator_category
Xapian::doccount get_rank() const
Return the MSet rank for the current position.
MSetIterator & operator--()
Move the iterator to the previous position.
int get_percent() const
Convert the weight of the current iterator position to a percentage.
Xapian::MSet::size_type off_from_end
MSetIterator & operator-=(difference_type n)
Move the iterator back by n positions.
Xapian::termcount_diff difference_type
MSetIterator operator+(difference_type n) const
Return the iterator incremented by n positions.
double get_weight() const
Get the weight for the current position.
MSetIterator(const Xapian::MSet &mset_, Xapian::doccount off_from_end_)
MSetIterator & operator++()
Advance the iterator to the next position.
MSetIterator operator--(int)
Move the iterator to the previous position (postfix version).
difference_type operator-(const MSetIterator &o) const
Return the number of positions between o and this iterator.
MSetIterator operator++(int)
Advance the iterator to the next position (postfix version).
Class representing a list of search results.
Xapian::doccount_diff difference_type
Xapian::doccount size() const
Return number of items in this MSet object.
void fetch() const
Prefetch hint the whole MSet.
Xapian::doccount max_size() const
void fetch_(Xapian::doccount first, Xapian::doccount last) const
Xapian::doccount size_type
Xapian::MSetIterator value_type
friend class MSetIterator
int convert_to_percent(double weight) const
Convert a weight to a percentage.
Xapian::MSetIterator iterator
bool empty() const
Return true if this MSet object is empty.
Xapian::Internal::intrusive_ptr< Internal > internal
Xapian::doccount get_firstitem() const
Rank of first item in this MSet.
MSetIterator operator[](Xapian::doccount i) const
Return iterator pointing to the i-th object in this MSet.
MSetIterator back() const
Return iterator pointing to the last object in this MSet.
void swap(MSet &o)
Efficiently swap this MSet object with another.
MSetIterator begin() const
Return iterator pointing to the first item in this MSet.
Xapian::MSetIterator const_iterator
MSetIterator end() const
Return iterator pointing to just after the last item in this MSet.
const value_type * const_pointer
const value_type & const_reference
Class representing a stemming algorithm.
API for working with documents.
The Xapian namespace contains public interfaces for the Xapian library.
XAPIAN_DOCID_BASE_TYPE doccount_diff
A signed difference between two counts of documents.
bool operator>=(const ESetIterator &a, const ESetIterator &b)
Inequality test for ESetIterator objects.
XAPIAN_TERMCOUNT_BASE_TYPE termcount_diff
A signed difference between two counts of terms.
bool operator<=(const ESetIterator &a, const ESetIterator &b)
Inequality test for ESetIterator objects.
bool operator>(const ESetIterator &a, const ESetIterator &b)
Inequality test for ESetIterator objects.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
bool operator==(const ESetIterator &a, const ESetIterator &b)
Equality test for ESetIterator objects.
bool operator!=(const ESetIterator &a, const ESetIterator &b)
Inequality test for ESetIterator objects.
ESetIterator operator+(ESetIterator::difference_type n, const ESetIterator &it)
Return ESetIterator it incremented by n positions.
double weight
The weight of a document or term.
bool operator<(const ESetIterator &a, const ESetIterator &b)
Inequality test for ESetIterator objects.
const Query operator*(double factor, const Query &q)
Scale a Xapian::Query object using OP_SCALE_WEIGHT.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
static Xapian::Stem stemmer
Define XAPIAN_VISIBILITY_* macros.
#define XAPIAN_VISIBILITY_DEFAULT