44 return "Xapian::Stopper subclass";
50 string desc(
"Xapian::SimpleStopper(");
51 set<string>::const_iterator i;
52 for (i = stop_words.begin(); i != stop_words.end(); ++i) {
53 if (i != stop_words.begin()) desc +=
' ';
93 internal->stem_action = strategy;
99 internal->stopper = stopper;
105 switch (default_op) {
117 "QueryParser::set_default_op() only accepts " 132 internal->default_op = default_op;
138 return internal->default_op;
152 internal->max_wildcard_expansion = max_expansion;
153 internal->max_wildcard_type = max_type;
156 internal->max_partial_expansion = max_expansion;
157 internal->max_partial_type = max_type;
163 const string &default_prefix)
166 internal->stoplist.clear();
167 internal->unstem.clear();
169 internal->errmsg = NULL;
171 if (query_string.empty())
return Query();
173 Query result =
internal->parse_query(query_string, flags, default_prefix);
176 result =
internal->parse_query(query_string, flags, default_prefix);
188 internal->add_prefix(field.substr(0, field.size() - 1), prefix);
190 internal->add_prefix(field, prefix);
199 internal->add_prefix(field.substr(0, field.size() - 1), proc);
201 internal->add_prefix(field, proc);
211 internal->add_boolean_prefix(field.substr(0, field.size() - 1),
214 internal->add_boolean_prefix(field, prefix, grouping);
225 internal->add_boolean_prefix(field.substr(0, field.size() - 1),
228 internal->add_boolean_prefix(field, proc, grouping);
235 const list<string> & sl =
internal->stoplist;
242 struct range_adaptor :
public multimap<string, string>::iterator {
243 range_adaptor(multimap<string, string>::iterator i) :
244 multimap<string, string>::iterator(i) {}
245 const string &
operator*()
const {
return (*this)->second; }
247 auto range =
internal->unstem.equal_range(term);
249 range_adaptor(range.second)));
257 internal->rangeprocs.push_back(
RangeProc(range_proc, grouping));
263 return internal->corrected_query;
270 return "Xapian::QueryParser()";
The Xapian namespace contains public interfaces for the Xapian library.
bool endswith(const std::string &s, char sfx)
void set_default_op(Query::op default_op)
Set the default operator.
This class is used to access a database, or a group of databases.
virtual ~ValueRangeProcessor()
Destructor.
Class representing a stemming algorithm.
void set_stopper(const Stopper *stop=NULL)
Set the stopper.
std::string get_corrected_query_string() const
Get the spelling-corrected query string.
TermIterator unstem_begin(const std::string &term) const
Begin iterator over unstemmed forms of the given stemmed query term.
Build a Xapian::Query object from a user query string.
Pick the maximum weight of any subquery.
Indicates a query string can't be parsed.
Produce a query which doesn't use positional information.
static Xapian::Stem stemmer
A vector-like container of terms which can be iterated.
void set_max_expansion(Xapian::termcount max_expansion, int max_type=Xapian::Query::WILDCARD_LIMIT_ERROR, unsigned flags=FLAG_WILDCARD|FLAG_PARTIAL)
Specify the maximum expansion of a wildcard and/or partial term.
The non-lemon-generated parts of the QueryParser class.
QueryParser()
Default constructor.
void add_rangeprocessor(Xapian::RangeProcessor *range_proc, const std::string *grouping=NULL)
Register a RangeProcessor.
void set_stemmer(const Xapian::Stem &stemmer)
Set the stemmer.
Hierarchy of classes which Xapian can throw as exceptions.
TermIterator stoplist_begin() const
Begin iterator over terms omitted from the query as stopwords.
Class for iterating over a list of terms.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
virtual ~FieldProcessor()
Destructor.
InvalidArgumentError indicates an invalid parameter value was passed to the API.
Base class for field processors.
Pick the best N subqueries and combine with OP_OR.
void set_stemming_strategy(stem_strategy strategy)
Set the stemming strategy.
Match only documents where all subqueries match near and in order.
~QueryParser()
Destructor.
stem_strategy
Stemming strategies, for use with set_stemming_strategy().
virtual ~RangeProcessor()
Destructor.
void add_boolean_prefix(const std::string &field, const std::string &prefix, const std::string *grouping=NULL)
Add a boolean term prefix allowing the user to restrict a search with a boolean filter specified in t...
Xapian::Internal::intrusive_ptr< Internal > internal
Query parse_query(const std::string &query_string, unsigned flags=FLAG_DEFAULT, const std::string &default_prefix=std::string())
Parse a query.
std::string get_description() const
Return a string describing this object.
Base class for range processors.
Match like OP_OR but weighting as if a single term.
This class stores a list of terms.
Match only documents which all subqueries match.
void set_database(const Database &db)
Specify the database being searched.
Accumulate unstem and stoplist results.
const Query operator*(double factor, const Query &q)
Scale a Xapian::Query object using OP_SCALE_WEIGHT.
virtual std::string get_description() const
Return a string describing this object.
QueryParser & operator=(const QueryParser &o)
Assignment.
Match only documents where all subqueries match near each other.
virtual std::string get_description() const
Return a string describing this object.
Match documents which at least one subquery matches.
Various handy helpers which std::string really should provide.
Abstract base class for stop-word decision functor.
Various assertion macros.
Class representing a query.
void add_prefix(const std::string &field, const std::string &prefix)
Add a free-text field term prefix.
Class for iterating over a list of terms.
Generate n-grams for scripts without explicit word breaks.
Query::op get_default_op() const
Get the current default operator.
parsing a user query string to build a Xapian::Query object