Switch to unified view

a/src/rcldb/rcldb.h b/src/rcldb/rcldb.h
...
...
14
 *   Free Software Foundation, Inc.,
14
 *   Free Software Foundation, Inc.,
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
 */
16
 */
17
#ifndef _DB_H_INCLUDED_
17
#ifndef _DB_H_INCLUDED_
18
#define _DB_H_INCLUDED_
18
#define _DB_H_INCLUDED_
19
/* @(#$Id: rcldb.h,v 1.44 2006-12-14 14:54:13 dockes Exp $  (C) 2004 J.F.Dockes */
19
/* @(#$Id: rcldb.h,v 1.45 2006-12-19 12:11:21 dockes Exp $  (C) 2004 J.F.Dockes */
20
20
21
#include <string>
21
#include <string>
22
#include <list>
22
#include <list>
23
#include <vector>
23
#include <vector>
24
24
...
...
51
#endif
51
#endif
52
52
53
class SearchData;
53
class SearchData;
54
class Native;
54
class Native;
55
class TermIter;
55
class TermIter;
56
 
56
57
class TermMatchEntry {
58
public:
59
    TermMatchEntry() : wcf(0) {}
60
    TermMatchEntry(const string&t, int f) : term(t), wcf(f) {}
61
    TermMatchEntry(const string&t) : term(t), wcf(0) {}
62
    string term;
63
    int    wcf; // Within collection frequency
64
};
65
57
/**
66
/**
58
 * Wrapper class for the native database.
67
 * Wrapper class for the native database.
59
 */
68
 */
60
class Db {
69
class Db {
61
 public:
70
 public:
...
...
107
    bool getMatchTerms(const Doc& doc, list<string>& terms);
116
    bool getMatchTerms(const Doc& doc, list<string>& terms);
108
117
109
    /** Return a list of index terms that match the input string
118
    /** Return a list of index terms that match the input string
110
     * Expansion is performed either with either wildcard or regexp processing
119
     * Expansion is performed either with either wildcard or regexp processing
111
     * Stem expansion is performed if lang is not empty */
120
     * Stem expansion is performed if lang is not empty */
112
    enum MatchType {ET_WILD, ET_REGEXP};
121
    enum MatchType {ET_WILD, ET_REGEXP, ET_STEM};
113
    bool termMatch(MatchType typ, const string &s, list<string>& result,
122
    bool termMatch(MatchType typ, const string &lang, const string &s, 
114
         const string &lang, int max=20);
123
         list<TermMatchEntry>& result, int max = -1);
115
124
116
    /** Add extra database for querying */
125
    /** Add extra database for querying */
117
    bool addQueryDb(const string &dir);
126
    bool addQueryDb(const string &dir);
118
    /** Remove extra database. if dir == "", remove all. */
127
    /** Remove extra database. if dir == "", remove all. */
119
    bool rmQueryDb(const string &dir);
128
    bool rmQueryDb(const string &dir);
...
...
157
    bool termExists(const string& term);
166
    bool termExists(const string& term);
158
    /** Test if terms stem to different roots. */
167
    /** Test if terms stem to different roots. */
159
    bool stemDiffers(const string& lang, const string& term, 
168
    bool stemDiffers(const string& lang, const string& term, 
160
             const string& base);
169
             const string& base);
161
    
170
    
162
    /** Perform stem expansion across all dbs configured for searching */
163
    list<string> stemExpand(const string& lang, const string& term);
164
165
    /** Filename wildcard expansion */
171
    /** Filename wildcard expansion */
166
    bool filenameWildExp(const string& exp, list<string>& names);
172
    bool filenameWildExp(const string& exp, list<string>& names);
167
    string getReason(){return m_reason;}
173
    string getReason(){return m_reason;}
174
175
168
private:
176
private:
169
177
170
    string m_filterTopDir; // Current query filter on subtree top directory 
178
    string m_filterTopDir; // Current query filter on subtree top directory 
171
    vector<int> m_dbindices; // In case there is a postq filter: sequence of 
179
    vector<int> m_dbindices; // In case there is a postq filter: sequence of 
172
                             // db indices that match
180
                             // db indices that match
...
...
199
    OpenMode m_mode;
207
    OpenMode m_mode;
200
208
201
    vector<bool> updated;
209
    vector<bool> updated;
202
210
203
    bool reOpen(); // Close/open, same mode/opts
211
    bool reOpen(); // Close/open, same mode/opts
212
    bool stemExpand(const string &lang, const string &s, 
213
          list<TermMatchEntry>& result, int max = -1);
204
214
205
    /* Copyconst and assignemt private and forbidden */
215
    /* Copyconst and assignemt private and forbidden */
206
    Db(const Db &) {}
216
    Db(const Db &) {}
207
    Db & operator=(const Db &) {return *this;};
217
    Db & operator=(const Db &) {return *this;};
208
};
218
};