23 #ifndef XAPIAN_INCLUDED_QUERYPARSER_H 24 #define XAPIAN_INCLUDED_QUERYPARSER_H 26 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD 27 # error Never use <xapian/queryparser.h> directly; include <xapian.h> instead. 53 void operator=(
const Stopper &);
66 virtual bool operator()(
const std::string & term)
const = 0;
72 virtual std::string get_description()
const;
82 opt_intrusive_base::release();
94 opt_intrusive_base::release();
120 template<
class Iterator>
124 void add(
const std::string & word) { stop_words.insert(word); }
127 return stop_words.find(term) != stop_words.end();
130 virtual std::string get_description()
const;
192 const std::string& str_ = std::string(),
194 : slot(slot_), str(str_), flags(flags_) { }
204 Xapian::Query check_range(
const std::string& b,
const std::string& e);
222 operator()(
const std::string &begin,
const std::string &end);
232 opt_intrusive_base::release();
244 opt_intrusive_base::release();
272 int epoch_year_ = 1970)
274 epoch_year(epoch_year_) { }
318 unsigned flags_ = 0,
int epoch_year_ = 1970)
320 epoch_year(epoch_year_) { }
333 Xapian::Query operator()(
const std::string& begin,
const std::string& end);
384 const std::string &str_ = std::string(),
400 Xapian::Query operator()(
const std::string& begin,
const std::string& end);
433 virtual Xapian::valueno operator()(std::string &begin, std::string &end) = 0;
443 opt_intrusive_base::release();
455 opt_intrusive_base::release();
483 : valno(slot_), str() { }
495 : valno(slot_), prefix(prefix_), str(str_) { }
536 int epoch_year_ = 1970)
538 prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { }
579 bool prefer_mdy_ =
false,
int epoch_year_ = 1970)
581 prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { }
630 bool prefer_mdy_ =
false,
int epoch_year_ = 1970)
632 prefer_mdy(prefer_mdy_), epoch_year(epoch_year_) { }
750 virtual Xapian::Query operator()(
const std::string &str) = 0;
760 opt_intrusive_base::release();
772 opt_intrusive_base::release();
794 FLAG_BOOLEAN_ANY_CASE = 8,
852 FLAG_SPELLING_CORRECTION = 128,
864 FLAG_AUTO_SYNONYMS = 512,
871 FLAG_AUTO_MULTIWORD_SYNONYMS = 1024,
904 FLAG_CJK_NGRAM = FLAG_NGRAMS,
919 FLAG_ACCUMULATE = 65536,
930 FLAG_NO_POSITIONS = 0x20000,
939 FLAG_DEFAULT = FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE
944 STEM_NONE, STEM_SOME, STEM_ALL, STEM_ALL_Z, STEM_SOME_FULL_POS
953 #ifdef XAPIAN_MOVE_SEMANTICS 1004 void set_stemming_strategy(stem_strategy strategy);
1011 void set_stopper(
const Stopper *stop = NULL);
1027 void set_default_op(
Query::op default_op);
1038 void set_database(
const Database &db);
1068 unsigned flags = FLAG_WILDCARD|FLAG_PARTIAL);
1107 Query parse_query(
const std::string &query_string,
1108 unsigned flags = FLAG_DEFAULT,
1109 const std::string &default_prefix = std::string());
1155 void add_prefix(
const std::string& field,
const std::string& prefix);
1220 void add_boolean_prefix(
const std::string &field,
const std::string &prefix,
1221 const std::string*
grouping = NULL);
1248 add_boolean_prefix(field, prefix);
1250 std::string empty_grouping;
1251 add_boolean_prefix(field, prefix, &empty_grouping);
1258 const std::string*
grouping = NULL);
1268 add_boolean_prefix(field, proc);
1270 std::string empty_grouping;
1271 add_boolean_prefix(field, proc, &empty_grouping);
1284 TermIterator unstem_begin(
const std::string &term)
const;
1293 const std::string*
grouping = NULL);
1303 # pragma GCC diagnostic push 1304 # pragma GCC diagnostic ignored "-Wdeprecated-declarations" 1315 operator()(
const std::string &begin,
const std::string &end)
1317 std::string b = begin, e = end;
1318 slot = (*vrp)(b, e);
1325 add_rangeprocessor((
new ShimRangeProcessor(vrproc))->release());
1327 # pragma GCC diagnostic pop 1338 std::string get_corrected_query_string()
const;
1341 std::string get_description()
const;
1347 set_max_expansion(max_expansion,
1406 #endif // XAPIAN_INCLUDED_QUERYPARSER_H
The Xapian namespace contains public interfaces for the Xapian library.
Stopper()
Default constructor.
void set_max_wildcard_expansion(Xapian::termcount)
Specify the maximum expansion of a wildcard.
RangeProcessor()
Default constructor.
DateRangeProcessor(Xapian::valueno slot_, unsigned flags_=0, int epoch_year_=1970)
Constructor.
Simple implementation of Stopper class - this will suit most users.
This class is used to access a database, or a group of databases.
bool prefix
Whether to look for str as a prefix or suffix.
Class representing a stemming algorithm.
void add_valuerangeprocessor(Xapian::ValueRangeProcessor *vrproc)
Register a ValueRangeProcessor.
Xapian::valueno valno
The value slot to process.
FieldProcessor * release()
Start reference counting this object.
Compiler attribute macros.
RangeProcessor(Xapian::valueno slot_, const std::string &str_=std::string(), unsigned flags_=0)
Constructor.
Build a Xapian::Query object from a user query string.
Define XAPIAN_DEPRECATED() and related macros.
ValueRangeProcessor()
Default constructor.
SimpleStopper()
Default constructor.
SimpleStopper(Iterator begin, Iterator end)
Initialise from a pair of iterators.
virtual Xapian::Query operator()(const std::string &begin, const std::string &end)
Check for a valid range of this type.
std::string sortable_serialise(double value)
Convert a floating point number to a string, preserving sort order.
ValueRangeProcessor * release()
Start reference counting this object.
void add(const std::string &word)
Add a single stop word.
const Stopper * release() const
Start reference counting this object.
static Xapian::Stem stemmer
Base class for value range processors.
#define XAPIAN_DEPRECATED(X)
virtual bool operator()(const std::string &term) const
Is term a stop-word?
#define XAPIAN_VISIBILITY_DEFAULT
Stopper * release()
Start reference counting this object.
TermIterator unstem_end(const std::string &) const
End iterator over unstemmed forms of the given stemmed query term.
Class for iterating over a list of terms.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Xapian::valueno slot
The value slot to process.
Base class for field processors.
size_t sortable_serialise_(double value, char *buf)
Define XAPIAN_VISIBILITY_* macros.
stem_strategy
Stemming strategies, for use with set_stemming_strategy().
#define XAPIAN_DEPRECATED_CLASS_EX
void add_boolean_prefix(const std::string &field, Xapian::FieldProcessor *proc, bool exclusive)
Register a FieldProcessor for a boolean prefix.
TermIterator stoplist_end() const
End iterator over terms omitted from the query as stopwords.
DateValueRangeProcessor(Xapian::valueno slot_, const std::string &str_, bool prefix_=true, bool prefer_mdy_=false, int epoch_year_=1970)
Constructor.
Throw an error if OP_WILDCARD exceeds its expansion limit.
const ValueRangeProcessor * release() const
Start reference counting this object.
void add_boolean_prefix(const std::string &field, const std::string &prefix, bool exclusive)
Add a boolean term prefix allowing the user to restrict a search with a boolean filter specified in t...
std::string str
The prefix (or suffix if prefix==false) string to look for.
Construct an invalid query.
NumberValueRangeProcessor(Xapian::valueno slot_, const std::string &str_, bool prefix_=true)
Constructor.
NumberRangeProcessor(Xapian::valueno slot_, const std::string &str_=std::string(), unsigned flags_=0)
Constructor.
Base class for objects managed by opt_intrusive_ptr.
Base class for range processors.
std::string str
The prefix (or suffix with RP_SUFFIX) string to look for.
double sortable_unserialise(const std::string &serialised)
Convert a string encoded using sortable_serialise back to a floating point number.
StringValueRangeProcessor(Xapian::valueno slot_)
Constructor.
NumberValueRangeProcessor(Xapian::valueno slot_)
Constructor.
virtual ~Stopper()
Class has virtual methods, so provide a virtual destructor.
const RangeProcessor * release() const
Start reference counting this object.
const FieldProcessor * release() const
Start reference counting this object.
RangeProcessor * release()
Start reference counting this object.
StringValueRangeProcessor(Xapian::valueno slot_, const std::string &str_, bool prefix_=true)
Constructor.
unsigned valueno
The number for a value slot in a document.
FieldProcessor()
Default constructor.
feature_flag
Enum of feature flags.
Abstract base class for stop-word decision functor.
Class representing a query.
const valueno BAD_VALUENO
Reserved value to indicate "no valueno".
DateRangeProcessor(Xapian::valueno slot_, const std::string &str_, unsigned flags_=0, int epoch_year_=1970)
Constructor.
A smart pointer that optionally uses intrusive reference counting.
A smart pointer that uses intrusive reference counting.
Class for iterating over a list of terms.
DateValueRangeProcessor(Xapian::valueno slot_, bool prefer_mdy_=false, int epoch_year_=1970)
Constructor.
std::set< std::string > stop_words
DateValueRangeProcessor(Xapian::valueno slot_, const char *str_, bool prefix_=true, bool prefer_mdy_=false, int epoch_year_=1970)
Constructor.