|
a/src/query/recollq.cpp |
|
b/src/query/recollq.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: recollq.cpp,v 1.3 2007-02-08 12:25:49 dockes Exp $ (C) 2006 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: recollq.cpp,v 1.4 2007-02-14 10:08:05 dockes Exp $ (C) 2006 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
138 |
return 1;
|
138 |
return 1;
|
139 |
}
|
139 |
}
|
140 |
|
140 |
|
141 |
RefCntr<Rcl::SearchData> rq(sd);
|
141 |
RefCntr<Rcl::SearchData> rq(sd);
|
142 |
rcldb.setQuery(rq, Rcl::Db::QO_STEM);
|
142 |
rcldb.setQuery(rq, Rcl::Db::QO_STEM);
|
143 |
int offset = 0;
|
|
|
144 |
int limit = 1000;
|
143 |
int limit = 2000;
|
145 |
cout << "Recoll query: " << rq->getDescription() << endl;
|
144 |
cout << "Recoll query: " << rq->getDescription() << endl;
|
146 |
int cnt = rcldb.getResCnt();
|
145 |
int cnt = rcldb.getResCnt();
|
147 |
cout << cnt << " results " <<
|
146 |
cout << cnt << " results " <<
|
148 |
(cnt <= limit ? "" : "(printing 100 max):") << endl;
|
147 |
(cnt <= limit ? "" : "(printing 2000 max):") << endl;
|
149 |
string tmpdir;
|
148 |
string tmpdir;
|
150 |
for (int i = offset; i < offset + limit; i++) {
|
149 |
for (int i = 0; i < limit; i++) {
|
151 |
int pc;
|
150 |
int pc;
|
152 |
Rcl::Doc doc;
|
151 |
Rcl::Doc doc;
|
153 |
if (!rcldb.getDoc(i, doc, &pc))
|
152 |
if (!rcldb.getDoc(i, doc, &pc))
|
154 |
break;
|
153 |
break;
|
155 |
|
154 |
|
156 |
char cpc[20];
|
155 |
char cpc[20];
|
157 |
sprintf(cpc, "%d", pc);
|
156 |
sprintf(cpc, "%d", pc);
|
158 |
cout << cpc << "%" << "\t"
|
157 |
cout
|
159 |
<< doc.mimetype.c_str() << "\t"
|
158 |
<< doc.mimetype.c_str() << "\t"
|
160 |
<< doc.dmtime.c_str() << "\t"
|
159 |
<< "[" << doc.url.c_str() << "]" << "\t"
|
|
|
160 |
<< "[" << doc.title.c_str() << "]" << "\t"
|
161 |
<< doc.fbytes.c_str() << "\tbytes" << "\t"
|
161 |
<< doc.fbytes.c_str() << "\tbytes" << "\t"
|
162 |
<< "[" << doc.url.c_str() << "]" << "\t"
|
|
|
163 |
<< "[" << doc.title.c_str() << "]"
|
|
|
164 |
<< endl;
|
162 |
<< endl;
|
165 |
|
163 |
|
166 |
if (op_flags & OPT_d) {
|
164 |
if (op_flags & OPT_d) {
|
167 |
string fn = doc.url.substr(7);
|
165 |
string fn = doc.url.substr(7);
|
168 |
struct stat st;
|
166 |
struct stat st;
|
169 |
if (stat(fn.c_str(), &st) != 0) {
|
167 |
if (stat(fn.c_str(), &st) != 0) {
|