LCOV - code coverage report
Current view: top level - queryparser - queryparser_internal.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core r Lines: 8 8 100.0 %
Date: 2011-08-21 Functions: 5 5 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* queryparser_internal.h: The non-lemon-generated parts of the QueryParser
       2                 :            :  * class.
       3                 :            :  *
       4                 :            :  * Copyright (C) 2005,2006,2007,2010,2011 Olly Betts
       5                 :            :  *
       6                 :            :  * This program is free software; you can redistribute it and/or
       7                 :            :  * modify it under the terms of the GNU General Public License as
       8                 :            :  * published by the Free Software Foundation; either version 2 of the
       9                 :            :  * License, or (at your option) any later version.
      10                 :            :  *
      11                 :            :  * This program is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :            :  * GNU General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU General Public License
      17                 :            :  * along with this program; if not, write to the Free Software
      18                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
      19                 :            :  * USA
      20                 :            :  */
      21                 :            : 
      22                 :            : #ifndef XAPIAN_INCLUDED_QUERYPARSER_INTERNAL_H
      23                 :            : #define XAPIAN_INCLUDED_QUERYPARSER_INTERNAL_H
      24                 :            : 
      25                 :            : #include <xapian/base.h>
      26                 :            : #include <xapian/database.h>
      27                 :            : #include <xapian/query.h>
      28                 :            : #include <xapian/queryparser.h>
      29                 :            : #include <xapian/stem.h>
      30                 :            : 
      31                 :            : #include <list>
      32                 :            : #include <map>
      33                 :            : 
      34                 :            : using namespace std;
      35                 :            : 
      36                 :            : class State;
      37                 :            : 
      38                 :            : typedef enum { NON_BOOLEAN, BOOLEAN, BOOLEAN_EXCLUSIVE } filter_type;
      39                 :            : 
      40                 :            : /** Information about how to handle a prefix in the query string. */
      41                 :      25295 : struct PrefixInfo {
      42                 :            :     /// The type of this prefix.
      43                 :            :     filter_type type;
      44                 :            : 
      45                 :            :     /// Prefix strings.
      46                 :            :     list<string> prefixes;
      47                 :            : 
      48                 :      25025 :     PrefixInfo(filter_type type_, const string & prefix)
      49                 :      25025 :         : type(type_)
      50                 :            :     {
      51                 :      25025 :         prefixes.push_back(prefix);
      52                 :      25025 :     }
      53                 :            : };
      54                 :            : 
      55                 :            : namespace Xapian {
      56                 :            : 
      57                 :            : class Utf8Iterator;
      58                 :            : 
      59                 :         81 : class QueryParser::Internal : public Xapian::Internal::RefCntBase {
      60                 :            :     friend class QueryParser;
      61                 :            :     friend class ::State;
      62                 :            :     Stem stemmer;
      63                 :            :     stem_strategy stem_action;
      64                 :            :     const Stopper * stopper;
      65                 :            :     Query::op default_op;
      66                 :            :     const char * errmsg;
      67                 :            :     Database db;
      68                 :            :     list<string> stoplist;
      69                 :            :     multimap<string, string> unstem;
      70                 :            : 
      71                 :            :     // Map "from" -> "A" ; "subject" -> "C" ; "newsgroups" -> "G" ;
      72                 :            :     // "foobar" -> "XFOO". FIXME: it does more than this now!
      73                 :            :     map<string, PrefixInfo> prefixmap;
      74                 :            : 
      75                 :            :     list<ValueRangeProcessor *> valrangeprocs;
      76                 :            : 
      77                 :            :     string corrected_query;
      78                 :            : 
      79                 :            :     void add_prefix(const string &field, const string &prefix,
      80                 :            :                     filter_type type);
      81                 :            : 
      82                 :            :     std::string parse_term(Utf8Iterator &it, const Utf8Iterator &end,
      83                 :            :                            bool cjk_ngram, bool &is_cjk_term,
      84                 :            :                            bool &was_acronym);
      85                 :            : 
      86                 :            :   public:
      87                 :         81 :     Internal() : stem_action(STEM_NONE), stopper(NULL),
      88                 :         81 :         default_op(Query::OP_OR), errmsg(NULL) { }
      89                 :            :     Query parse_query(const string & query_string, unsigned int flags, const string & default_prefix);
      90                 :            : };
      91                 :            : 
      92                 :            : }
      93                 :            : 
      94                 :            : #endif // XAPIAN_INCLUDED_QUERYPARSER_INTERNAL_H

Generated by: LCOV version 1.8