separated rcldb and rclquery
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: pyrecoll.cpp,v 1.2 2008-05-27 10:45:59 dockes Exp $ (C) 2007 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: pyrecoll.cpp,v 1.3 2008-06-13 18:22:46 dockes Exp $ (C) 2007 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <Python.h>
|
||||
@@ -11,6 +11,7 @@ using namespace std;
|
||||
#include "rclinit.h"
|
||||
#include "rclconfig.h"
|
||||
#include "rcldb.h"
|
||||
#include "rclquery.h"
|
||||
#include "pathut.h"
|
||||
#include "wasastringtoquery.h"
|
||||
#include "wasatorcl.h"
|
||||
@@ -31,7 +32,7 @@ recollq_question(PyObject *self, PyObject *args)
|
||||
string reason;
|
||||
string dbdir = config->getDbDir();
|
||||
rcldb.open(dbdir, config->getStopfile(),
|
||||
Rcl::Db::DbRO, Rcl::Db::QO_STEM);
|
||||
Rcl::Db::DbRO);
|
||||
|
||||
Rcl::SearchData *sd = wasaStringToRcl(qs, reason);
|
||||
if (!sd) {
|
||||
@@ -40,8 +41,9 @@ recollq_question(PyObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
RefCntr<Rcl::SearchData> rq(sd);
|
||||
rcldb.setQuery(rq, Rcl::Db::QO_STEM);
|
||||
int cnt = rcldb.getResCnt();
|
||||
RefCntr<Rcl::Query> query(new Rcl::Query(&rcldb));
|
||||
query->setQuery(rq, Rcl::Query::QO_STEM);
|
||||
int cnt = query->getResCnt();
|
||||
cout << "Recoll query: " << rq->getDescription() << endl;
|
||||
if (cnt <= limit)
|
||||
cout << cnt << " results" << endl;
|
||||
@@ -51,7 +53,7 @@ recollq_question(PyObject *self, PyObject *args)
|
||||
for (int i = 0; i < limit; i++) {
|
||||
int pc;
|
||||
Rcl::Doc doc;
|
||||
if (!rcldb.getDoc(i, doc, &pc))
|
||||
if (!query->getDoc(i, doc, &pc))
|
||||
break;
|
||||
char cpc[20];
|
||||
sprintf(cpc, "%d", pc);
|
||||
|
||||
@@ -3,8 +3,6 @@ from distutils.core import setup, Extension
|
||||
module1 = Extension('recollq',
|
||||
define_macros = [('MAJOR_VERSION', '1'),
|
||||
('MINOR_VERSION', '0'),
|
||||
('HAVE_MKDTEMP', '1'),
|
||||
('HAVE_VASPRINTF', '1'),
|
||||
('UNAC_VERSION', '"1.0.7"'),
|
||||
('STATFS_INCLUDE', '"sys/mount.h"'),
|
||||
('RECOLL_DATADIR',
|
||||
@@ -27,6 +25,7 @@ module1 = Extension('recollq',
|
||||
'../query/wasastringtoquery.cpp',
|
||||
'../query/wasatorcl.cpp',
|
||||
'../rcldb/rcldb.cpp',
|
||||
'../rcldb/rclquery.cpp',
|
||||
'../rcldb/searchdata.cpp',
|
||||
'../rcldb/stemdb.cpp',
|
||||
'../rcldb/pathhash.cpp',
|
||||
|
||||
Reference in New Issue
Block a user