added option to query language for filtering on directory
This commit is contained in:
parent
c229631136
commit
84a55dc42e
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: recollq.cpp,v 1.7 2007-06-19 15:47:25 dockes Exp $ (C) 2006 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: recollq.cpp,v 1.8 2007-10-25 07:27:30 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -54,6 +54,7 @@ static char usage [] =
|
|||||||
"Common options:\n"
|
"Common options:\n"
|
||||||
" -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR\n"
|
" -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR\n"
|
||||||
" -d also dump file contents\n"
|
" -d also dump file contents\n"
|
||||||
|
" -n <cnt> limit the maximum number of results (0->no limit, default 2000)\n"
|
||||||
;
|
;
|
||||||
static void
|
static void
|
||||||
Usage(void)
|
Usage(void)
|
||||||
@ -68,6 +69,7 @@ static int op_flags;
|
|||||||
#define OPT_a 0x4
|
#define OPT_a 0x4
|
||||||
#define OPT_c 0x8
|
#define OPT_c 0x8
|
||||||
#define OPT_d 0x10
|
#define OPT_d 0x10
|
||||||
|
#define OPT_n 0x20
|
||||||
|
|
||||||
static RclConfig *rclconfig;
|
static RclConfig *rclconfig;
|
||||||
RclConfig *RclConfig::getMainConfig()
|
RclConfig *RclConfig::getMainConfig()
|
||||||
@ -75,10 +77,10 @@ RclConfig *RclConfig::getMainConfig()
|
|||||||
return rclconfig;
|
return rclconfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
string a_config;
|
string a_config;
|
||||||
|
int limit = 2000;
|
||||||
thisprog = argv[0];
|
thisprog = argv[0];
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
|
|
||||||
@ -94,6 +96,10 @@ int main(int argc, char **argv)
|
|||||||
a_config = *(++argv);
|
a_config = *(++argv);
|
||||||
argc--; goto b1;
|
argc--; goto b1;
|
||||||
case 'd': op_flags |= OPT_d; break;
|
case 'd': op_flags |= OPT_d; break;
|
||||||
|
case 'n': op_flags |= OPT_n; if (argc < 2) Usage();
|
||||||
|
limit = atoi(*(++argv));
|
||||||
|
if (limit <= 0) limit = INT_MAX;
|
||||||
|
argc--; goto b1;
|
||||||
case 'o': op_flags |= OPT_o; break;
|
case 'o': op_flags |= OPT_o; break;
|
||||||
default: Usage(); break;
|
default: Usage(); break;
|
||||||
}
|
}
|
||||||
@ -147,11 +153,12 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
RefCntr<Rcl::SearchData> rq(sd);
|
RefCntr<Rcl::SearchData> rq(sd);
|
||||||
rcldb.setQuery(rq, Rcl::Db::QO_STEM);
|
rcldb.setQuery(rq, Rcl::Db::QO_STEM);
|
||||||
int limit = 2000;
|
|
||||||
cout << "Recoll query: " << rq->getDescription() << endl;
|
cout << "Recoll query: " << rq->getDescription() << endl;
|
||||||
int cnt = rcldb.getResCnt();
|
int cnt = rcldb.getResCnt();
|
||||||
cout << cnt << " results " <<
|
if (cnt <= limit)
|
||||||
(cnt <= limit ? "" : "(printing 2000 max):") << endl;
|
cout << cnt << " results:" << endl;
|
||||||
|
else
|
||||||
|
cout << cnt << " results (printing " << limit << " max):" << endl;
|
||||||
string tmpdir;
|
string tmpdir;
|
||||||
for (int i = 0; i < limit; i++) {
|
for (int i = 0; i < limit; i++) {
|
||||||
int pc;
|
int pc;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: wasatorcl.cpp,v 1.10 2007-10-05 14:00:04 dockes Exp $ (C) 2006 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: wasatorcl.cpp,v 1.11 2007-10-25 07:27:30 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -63,7 +63,7 @@ Rcl::SearchData *wasaQueryToRcl(WasaQuery *wasa)
|
|||||||
continue;
|
continue;
|
||||||
case WasaQuery::OP_LEAF:
|
case WasaQuery::OP_LEAF:
|
||||||
|
|
||||||
// Special cases for mime and category. Not pretty.
|
// Special cases (mime, category, dir filter ...). Not pretty.
|
||||||
if (!stringicmp("mime", (*it)->m_fieldspec)) {
|
if (!stringicmp("mime", (*it)->m_fieldspec)) {
|
||||||
sdata->addFiletype((*it)->m_value);
|
sdata->addFiletype((*it)->m_value);
|
||||||
break;
|
break;
|
||||||
@ -79,6 +79,10 @@ Rcl::SearchData *wasaQueryToRcl(WasaQuery *wasa)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!stringicmp("dir", (*it)->m_fieldspec)) {
|
||||||
|
sdata->setTopdir((*it)->m_value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ((*it)->m_value.find_first_of(" \t\n\r") != string::npos) {
|
if ((*it)->m_value.find_first_of(" \t\n\r") != string::npos) {
|
||||||
nclause = new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE,
|
nclause = new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user