|
a/src/rcldb/rcldb.cpp |
|
b/src/rcldb/rcldb.cpp |
|
... |
|
... |
140 |
|
140 |
|
141 |
// Turn data record from db into document fields
|
141 |
// Turn data record from db into document fields
|
142 |
bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data,
|
142 |
bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data,
|
143 |
Doc &doc, int percent)
|
143 |
Doc &doc, int percent)
|
144 |
{
|
144 |
{
|
145 |
LOGDEB0(("Db::dbDataToRclDoc: data:\n %s\n", data.c_str()));
|
145 |
LOGDEB2(("Db::dbDataToRclDoc: data:\n%s\n", data.c_str()));
|
146 |
ConfSimple parms(data);
|
146 |
ConfSimple parms(data);
|
147 |
if (!parms.ok())
|
147 |
if (!parms.ok())
|
148 |
return false;
|
148 |
return false;
|
149 |
parms.get(Doc::keyurl, doc.url);
|
149 |
parms.get(Doc::keyurl, doc.url);
|
150 |
parms.get(Doc::keytp, doc.mimetype);
|
150 |
parms.get(Doc::keytp, doc.mimetype);
|
|
... |
|
... |
223 |
// DatabaseModified and other general exceptions are catched and
|
223 |
// DatabaseModified and other general exceptions are catched and
|
224 |
// possibly retried by our caller
|
224 |
// possibly retried by our caller
|
225 |
string Db::Native::makeAbstract(Xapian::docid docid, Query *query)
|
225 |
string Db::Native::makeAbstract(Xapian::docid docid, Query *query)
|
226 |
{
|
226 |
{
|
227 |
Chrono chron;
|
227 |
Chrono chron;
|
228 |
LOGDEB(("makeAbstract:%d: maxlen %d wWidth %d\n", chron.ms(),
|
228 |
LOGDEB0(("makeAbstract:%d: maxlen %d wWidth %d\n", chron.ms(),
|
229 |
m_rcldb->m_synthAbsLen, m_rcldb->m_synthAbsWordCtxLen));
|
229 |
m_rcldb->m_synthAbsLen, m_rcldb->m_synthAbsWordCtxLen));
|
230 |
|
230 |
|
231 |
list<string> terms;
|
231 |
list<string> terms;
|
232 |
|
232 |
|
233 |
{
|
233 |
{
|
|
... |
|
... |
431 |
term != xrdb.termlist_end(docid); term++) {
|
431 |
term != xrdb.termlist_end(docid); term++) {
|
432 |
// Ignore prefixed terms
|
432 |
// Ignore prefixed terms
|
433 |
if ('A' <= (*term).at(0) && (*term).at(0) <= 'Z')
|
433 |
if ('A' <= (*term).at(0) && (*term).at(0) <= 'Z')
|
434 |
continue;
|
434 |
continue;
|
435 |
if (cutoff-- < 0) {
|
435 |
if (cutoff-- < 0) {
|
436 |
LOGDEB(("makeAbstract: max term count cutoff\n"));
|
436 |
LOGDEB0(("makeAbstract: max term count cutoff\n"));
|
437 |
break;
|
437 |
break;
|
438 |
}
|
438 |
}
|
439 |
|
439 |
|
440 |
Xapian::PositionIterator pos;
|
440 |
Xapian::PositionIterator pos;
|
441 |
for (pos = xrdb.positionlist_begin(docid, *term);
|
441 |
for (pos = xrdb.positionlist_begin(docid, *term);
|
442 |
pos != xrdb.positionlist_end(docid, *term); pos++) {
|
442 |
pos != xrdb.positionlist_end(docid, *term); pos++) {
|
443 |
if (cutoff-- < 0) {
|
443 |
if (cutoff-- < 0) {
|
444 |
LOGDEB(("makeAbstract: max term count cutoff\n"));
|
444 |
LOGDEB0(("makeAbstract: max term count cutoff\n"));
|
445 |
break;
|
445 |
break;
|
446 |
}
|
446 |
}
|
447 |
map<unsigned int, string>::iterator vit;
|
447 |
map<unsigned int, string>::iterator vit;
|
448 |
if ((vit=sparseDoc.find(*pos)) != sparseDoc.end()) {
|
448 |
if ((vit=sparseDoc.find(*pos)) != sparseDoc.end()) {
|
449 |
// Don't replace a term: the terms list is in
|
449 |
// Don't replace a term: the terms list is in
|
|
... |
|
... |
502 |
// This happens for docs with no terms (only filename) indexed? I'll fix
|
502 |
// This happens for docs with no terms (only filename) indexed? I'll fix
|
503 |
// one day (yeah)
|
503 |
// one day (yeah)
|
504 |
if (!abstract.compare("... "))
|
504 |
if (!abstract.compare("... "))
|
505 |
abstract.clear();
|
505 |
abstract.clear();
|
506 |
|
506 |
|
507 |
LOGDEB(("makeAbtract: done in %d mS\n", chron.millis()));
|
507 |
LOGDEB0(("makeAbtract: done in %d mS\n", chron.millis()));
|
508 |
return abstract;
|
508 |
return abstract;
|
509 |
}
|
509 |
}
|
510 |
|
510 |
|
511 |
/* Rcl::Db methods ///////////////////////////////// */
|
511 |
/* Rcl::Db methods ///////////////////////////////// */
|
512 |
|
512 |
|