21 #ifndef XAPIAN_INCLUDED_QUERYINTERNAL_H
22 #define XAPIAN_INCLUDED_QUERYINTERNAL_H
37 struct PostListAndEstimate;
77 void serialise(std::string & result)
const;
94 void serialise(std::string & result)
const;
119 return subquery.
internal->get_length();
122 void serialise(std::string & result)
const;
149 std::string_view begin_,
150 std::string_view end_)
157 void serialise(std::string & result)
const;
175 void serialise(std::string & result)
const;
193 void serialise(std::string & result)
const;
206 explicit QueryBranch(
size_t n_subqueries) : subqueries(n_subqueries) { }
213 size_t first = 0)
const;
225 bool keep_zero_weight =
true)
const;
235 const std::string get_description_helper(
const char * op,
241 void serialise(std::
string & result) const;
307 bool keep_zero_weight)
const;
420 void serialise(std::string & result)
const;
437 void serialise(std::string & result)
const;
457 void serialise(std::string & result)
const;
467 bool keep_zero_weight)
const;
513 size_t head = 0, tail = 0, min_len = 0, max_len = 0;
525 size_t min_check_len = size_t(-1);
529 bool test_wildcard_(
const std::string& candidate,
size_t o,
size_t p,
539 bool test_prefix_known(
const std::string& candidate)
const;
542 bool test(
const std::string& candidate)
const {
543 return startswith(candidate, prefix) && test_prefix_known(candidate);
548 std::
string get_pattern()
const {
return pattern; }
553 return flags &~ Xapian::Query::WILDCARD_LIMIT_MASK_;
566 void serialise(std::
string & result) const;
611 unsigned edit_distance_ = 2,
612 size_t fixed_prefix_len_ = 0)
614 max_expansion(max_expansion_),
618 edit_distance(edit_distance_),
619 fixed_prefix_len(fixed_prefix_len_) { }
625 int test(
const std::string& candidate)
const;
629 std::
string get_pattern()
const {
return pattern; }
636 return flags &~ Xapian::Query::WILDCARD_LIMIT_MASK_;
644 return edit_distance;
653 void serialise(std::
string & result) const;
687 void serialise(std::
string & result) const;
#define XAPIAN_PURE_FUNCTION
Like XAPIAN_CONST_FUNCTION, but such a function can also examine global memory, perhaps via pointer o...
Calculate edit distances to a target string.
QueryAndLike(size_t num_subqueries_)
QueryAndMaybe(size_t n_subqueries)
QueryAndNot(size_t n_subqueries)
QueryAnd(size_t n_subqueries)
virtual Xapian::Query::op get_op() const =0
QueryBranch(size_t n_subqueries)
Xapian::termcount get_max_expansion() const
Xapian::termcount max_expansion
size_t get_fixed_prefix_len() const
unsigned get_threshold() const
int get_just_flags() const
QueryEditDistance(std::string_view pattern_, Xapian::termcount max_expansion_, int flags_, Query::op combiner_, unsigned edit_distance_=2, size_t fixed_prefix_len_=0)
EditDistanceCalculator edcalc
Xapian::termcount set_size
QueryEliteSet(size_t n_subqueries, Xapian::termcount set_size_)
QueryFilter(size_t n_subqueries)
QueryMax(size_t n_subqueries)
QueryNear(size_t n_subqueries, Xapian::termcount window_)
QueryOrLike(size_t num_subqueries_)
QueryOr(size_t n_subqueries)
QueryPhrase(size_t n_subqueries, Xapian::termcount window_)
PostListAndEstimate postlist(QueryOptimiser *qopt, double factor, TermFreqs *termfreqs) const
Xapian::Internal::opt_intrusive_ptr< PostingSource > source
std::string get_description() const
Xapian::Query::op get_type() const noexcept
QueryPostingSource(PostingSource *source_)
void serialise(std::string &result) const
termcount get_length() const noexcept
QuerySynonym(size_t n_subqueries)
void serialise(std::string &result) const
std::string get_description() const
void gather_terms(void *void_terms) const
QueryTerm(std::string_view term_, Xapian::termcount wqf_, Xapian::termpos pos_)
PostListAndEstimate postlist(QueryOptimiser *qopt, double factor, TermFreqs *termfreqs) const
const std::string & get_term() const
termcount get_length() const noexcept
termcount get_wqf() const
bool postlist_sub_and_like(AndContext &ctx, QueryOptimiser *qopt, double factor, TermFreqs *termfreqs) const
Xapian::Query::op get_type() const noexcept
QueryValueBase(Xapian::valueno slot_)
Xapian::valueno get_slot() const
QueryValueGE(Xapian::valueno slot_, std::string_view limit_)
QueryValueLE(Xapian::valueno slot_, std::string_view limit_)
QueryValueRange(Xapian::valueno slot_, std::string_view begin_, std::string_view end_)
std::string get_fixed_prefix() const
Return the fixed prefix from the wildcard pattern.
Xapian::termcount max_expansion
bool test(const std::string &candidate) const
Perform full wildcard test on candidate.
Xapian::termcount get_max_expansion() const
int get_just_flags() const
QueryWindowed(size_t n_subqueries, Xapian::termcount window_)
size_t get_window() const
QueryXor(size_t n_subqueries)
unsigned _refs
Reference count.
A smart pointer that optionally uses intrusive reference counting.
Base class which provides an "external" source of postings.
virtual void postlist_sub_bool_or_like(Xapian::Internal::OrContext &ctx, Xapian::Internal::QueryOptimiser *qopt, Xapian::Internal::TermFreqs *termfreqs) const
virtual termcount get_length() const noexcept
virtual const Query get_subquery(size_t n) const
virtual bool postlist_sub_and_like(Xapian::Internal::AndContext &ctx, Xapian::Internal::QueryOptimiser *qopt, double factor, Xapian::Internal::TermFreqs *termfreqs) const
virtual void postlist_sub_or_like(Xapian::Internal::OrContext &ctx, Xapian::Internal::QueryOptimiser *qopt, double factor, Xapian::Internal::TermFreqs *termfreqs, bool keep_zero_weight=true) const
virtual void gather_terms(void *void_terms) const
virtual void postlist_sub_xor(Xapian::Internal::XorContext &ctx, Xapian::Internal::QueryOptimiser *qopt, double factor, Xapian::Internal::TermFreqs *termfreqs) const
virtual size_t get_num_subqueries() const noexcept
Class representing a query.
Xapian::Internal::intrusive_ptr< Internal > internal
Edit distance calculation algorithm.
The Xapian namespace contains public interfaces for the Xapian library.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
unsigned valueno
The number for a value slot in a document.
unsigned XAPIAN_TERMPOS_BASE_TYPE termpos
A term position within a document or query.
const Xapian::termcount DEFAULT_ELITE_SET_SIZE
Default set_size for OP_ELITE_SET:
Append only vector of Query objects.
Various handy string-related helpers.
bool startswith(std::string_view s, char pfx)
The frequencies for a term.