|
a/src/rcldb/rcldb.h |
|
b/src/rcldb/rcldb.h |
1 |
#ifndef _DB_H_INCLUDED_
|
1 |
#ifndef _DB_H_INCLUDED_
|
2 |
#define _DB_H_INCLUDED_
|
2 |
#define _DB_H_INCLUDED_
|
3 |
/* @(#$Id: rcldb.h,v 1.17 2005-11-14 09:56:49 dockes Exp $ (C) 2004 J.F.Dockes */
|
3 |
/* @(#$Id: rcldb.h,v 1.18 2005-11-25 08:53:13 dockes Exp $ (C) 2004 J.F.Dockes */
|
4 |
|
4 |
|
5 |
#include <string>
|
5 |
#include <string>
|
6 |
#include <list>
|
6 |
#include <list>
|
7 |
#include <vector>
|
7 |
#include <vector>
|
8 |
#ifndef NO_NAMESPACES
|
8 |
#ifndef NO_NAMESPACES
|
|
... |
|
... |
85 |
|
85 |
|
86 |
/**
|
86 |
/**
|
87 |
* Wrapper class for the native database.
|
87 |
* Wrapper class for the native database.
|
88 |
*/
|
88 |
*/
|
89 |
class Db {
|
89 |
class Db {
|
90 |
AdvSearchData asdata;
|
|
|
91 |
vector<int> dbindices; // In case there is a postq filter: sequence of
|
|
|
92 |
// db indices that match
|
|
|
93 |
void *pdata; // Pointer to private data. We don't want db(ie
|
|
|
94 |
// xapian)-specific defs to show in here
|
|
|
95 |
public:
|
90 |
public:
|
96 |
Db();
|
91 |
Db();
|
97 |
~Db();
|
92 |
~Db();
|
98 |
enum OpenMode {DbRO, DbUpd, DbTrunc};
|
93 |
enum OpenMode {DbRO, DbUpd, DbTrunc};
|
99 |
bool open(const string &dbdir, OpenMode mode);
|
94 |
bool open(const string &dbdir, OpenMode mode);
|
100 |
bool close();
|
95 |
bool close();
|
|
... |
|
... |
114 |
const string& stemlang = "english");
|
109 |
const string& stemlang = "english");
|
115 |
bool setQuery(AdvSearchData &q, QueryOpts opts = QO_NONE,
|
110 |
bool setQuery(AdvSearchData &q, QueryOpts opts = QO_NONE,
|
116 |
const string& stemlang = "english");
|
111 |
const string& stemlang = "english");
|
117 |
bool getQueryTerms(list<string>& terms);
|
112 |
bool getQueryTerms(list<string>& terms);
|
118 |
|
113 |
|
119 |
// Get document at rank i. This is probably vastly inferior to the type
|
114 |
/** Get document at rank i in current query.
|
|
|
115 |
|
|
|
116 |
This is probably vastly inferior to the type of interface in
|
120 |
// of interface in Xapian, but we have to start with something simple
|
117 |
Xapian, but we have to start with something simple to
|
121 |
// to experiment with the GUI. i is sequential from 0 to some value
|
118 |
experiment with the GUI. i is sequential from 0 to some value.
|
|
|
119 |
*/
|
122 |
bool getDoc(int i, Doc &doc, int *percent = 0);
|
120 |
bool getDoc(int i, Doc &doc, int *percent = 0);
|
123 |
// Get results count
|
121 |
|
|
|
122 |
/** Get document for given filename and ipath */
|
|
|
123 |
bool getDoc(const string &fn, const string &ipath, Doc &doc);
|
|
|
124 |
|
|
|
125 |
/** Get results count for current query */
|
124 |
int getResCnt();
|
126 |
int getResCnt();
|
125 |
|
127 |
|
126 |
friend class Rcl::DbPops;
|
128 |
friend class Rcl::DbPops;
|
|
|
129 |
|
127 |
private:
|
130 |
private:
|
|
|
131 |
|
|
|
132 |
AdvSearchData asdata;
|
|
|
133 |
vector<int> dbindices; // In case there is a postq filter: sequence of
|
|
|
134 |
// db indices that match
|
|
|
135 |
void *pdata; // Pointer to private data. We don't want db(ie
|
|
|
136 |
// xapian)-specific defs to show in here
|
128 |
/* Copyconst and assignemt private and forbidden */
|
137 |
/* Copyconst and assignemt private and forbidden */
|
129 |
Db(const Db &) {}
|
138 |
Db(const Db &) {}
|
130 |
Db & operator=(const Db &) {return *this;};
|
139 |
Db & operator=(const Db &) {return *this;};
|
131 |
};
|
140 |
};
|
132 |
|
141 |
|