00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef XAPIAN_INCLUDED_QUERYPARSER_INTERNAL_H
00024 #define XAPIAN_INCLUDED_QUERYPARSER_INTERNAL_H
00025
00026 #include <xapian/base.h>
00027 #include <xapian/database.h>
00028 #include <xapian/query.h>
00029 #include <xapian/queryparser.h>
00030 #include <xapian/stem.h>
00031
00032 #include <list>
00033 #include <map>
00034
00035 using namespace std;
00036
00037 class State;
00038
00039 typedef enum { NON_BOOLEAN, BOOLEAN, BOOLEAN_EXCLUSIVE } filter_type;
00040
00042 struct PrefixInfo {
00044 filter_type type;
00045
00047 list<string> prefixes;
00048
00049 PrefixInfo(filter_type type_, const string & prefix)
00050 : type(type_)
00051 {
00052 prefixes.push_back(prefix);
00053 }
00054 };
00055
00056 namespace Xapian {
00057
00058 class Utf8Iterator;
00059
00060 class QueryParser::Internal : public Xapian::Internal::RefCntBase {
00061 friend class QueryParser;
00062 friend class ::State;
00063 Stem stemmer;
00064 stem_strategy stem_action;
00065 const Stopper * stopper;
00066 Query::op default_op;
00067 const char * errmsg;
00068 Database db;
00069 list<string> stoplist;
00070 multimap<string, string> unstem;
00071
00072
00073
00074 map<string, PrefixInfo> prefixmap;
00075
00076 list<ValueRangeProcessor *> valrangeprocs;
00077
00078 string corrected_query;
00079
00080 Xapian::termcount max_wildcard_expansion;
00081
00082 void add_prefix(const string &field, const string &prefix,
00083 filter_type type);
00084
00085 std::string parse_term(Utf8Iterator &it, const Utf8Iterator &end,
00086 bool cjk_ngram, bool &is_cjk_term,
00087 bool &was_acronym);
00088
00089 public:
00090 Internal() : stem_action(STEM_NONE), stopper(NULL),
00091 default_op(Query::OP_OR), errmsg(NULL), max_wildcard_expansion(0) { }
00092 Query parse_query(const string & query_string, unsigned int flags, const string & default_prefix);
00093 };
00094
00095 }
00096
00097 #endif // XAPIAN_INCLUDED_QUERYPARSER_INTERNAL_H