Added -i option to recollq to specify extra indexes
This commit is contained in:
parent
097bc578be
commit
4b08502de7
@ -29,6 +29,8 @@ static char rcsid[] = "@(#$Id: recollq.cpp,v 1.22 2008-12-17 08:01:40 dockes Exp
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <list>
|
||||||
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
@ -89,6 +91,7 @@ static char usage [] =
|
|||||||
" -A : output the document abstracts\n"
|
" -A : output the document abstracts\n"
|
||||||
" -S fld : sort by field name\n"
|
" -S fld : sort by field name\n"
|
||||||
" -D : sort descending\n"
|
" -D : sort descending\n"
|
||||||
|
" -i <dbdir> : additional index, several can be given\n"
|
||||||
;
|
;
|
||||||
static void
|
static void
|
||||||
Usage(void)
|
Usage(void)
|
||||||
@ -115,12 +118,14 @@ static int op_flags;
|
|||||||
#define OPT_S 0x2000
|
#define OPT_S 0x2000
|
||||||
#define OPT_s 0x4000
|
#define OPT_s 0x4000
|
||||||
#define OPT_A 0x8000
|
#define OPT_A 0x8000
|
||||||
|
#define OPT_i 0x10000
|
||||||
|
|
||||||
int recollq(RclConfig **cfp, int argc, char **argv)
|
int recollq(RclConfig **cfp, int argc, char **argv)
|
||||||
{
|
{
|
||||||
string a_config;
|
string a_config;
|
||||||
string sortfield;
|
string sortfield;
|
||||||
string stemlang("english");
|
string stemlang("english");
|
||||||
|
list<string> extra_dbs;
|
||||||
|
|
||||||
int limit = 2000;
|
int limit = 2000;
|
||||||
thisprog = argv[0];
|
thisprog = argv[0];
|
||||||
@ -142,6 +147,9 @@ int recollq(RclConfig **cfp, int argc, char **argv)
|
|||||||
case 'd': op_flags |= OPT_d; break;
|
case 'd': op_flags |= OPT_d; break;
|
||||||
case 'D': op_flags |= OPT_D; break;
|
case 'D': op_flags |= OPT_D; break;
|
||||||
case 'f': op_flags |= OPT_f; break;
|
case 'f': op_flags |= OPT_f; break;
|
||||||
|
case 'i': op_flags |= OPT_i; if (argc < 2) Usage();
|
||||||
|
extra_dbs.push_back(*(++argv));
|
||||||
|
argc--; goto b1;
|
||||||
case 'l': op_flags |= OPT_l; break;
|
case 'l': op_flags |= OPT_l; break;
|
||||||
case 'm': op_flags |= OPT_m; break;
|
case 'm': op_flags |= OPT_m; break;
|
||||||
case 'n': op_flags |= OPT_n; if (argc < 2) Usage();
|
case 'n': op_flags |= OPT_n; if (argc < 2) Usage();
|
||||||
@ -193,6 +201,16 @@ int recollq(RclConfig **cfp, int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
Rcl::Db rcldb(rclconfig);
|
Rcl::Db rcldb(rclconfig);
|
||||||
|
if (!extra_dbs.empty()) {
|
||||||
|
for (list<string>::iterator it = extra_dbs.begin();
|
||||||
|
it != extra_dbs.end(); it++) {
|
||||||
|
if (!rcldb.addQueryDb(*it)) {
|
||||||
|
cerr << "Can't add index: " << *it << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!rcldb.open(Rcl::Db::DbRO)) {
|
if (!rcldb.open(Rcl::Db::DbRO)) {
|
||||||
cerr << "Cant open database in " << rclconfig->getDbDir() <<
|
cerr << "Cant open database in " << rclconfig->getDbDir() <<
|
||||||
" reason: " << rcldb.getReason() << endl;
|
" reason: " << rcldb.getReason() << endl;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user