1st beagle version with index/preview working

This commit is contained in:
dockes
2009-11-13 13:29:34 +00:00
parent efa501f06d
commit bbba826c06
12 changed files with 341 additions and 152 deletions
+2
View File
@@ -40,6 +40,8 @@ namespace Rcl {
const string Doc::keytt("title");
const string Doc::keykw("keywords");
const string Doc::keymd5("md5");
const string Doc::keybcknd("rclbes");
const string Doc::keyudi("rcludi");
void Doc::dump(bool dotext) const
{
+6 -3
View File
@@ -44,9 +44,9 @@ class Doc {
// can be accessed after a query without fetching the actual document).
// We indicate the routine that sets them up during indexing
// This is just "file://" + binary or url-encoded filename. No
// transcoding: this is used to access files Index: computed from
// fn by Db::add caller. Query: from doc data.
// Binary or url-encoded url. No transcoding: this is used to access files
// Index: computed by Db::add caller.
// Query: from doc data.
string url;
// Transcoded version of the simple file name for SFN-prefixed
@@ -160,6 +160,9 @@ class Doc {
static const string keytt; // title
static const string keykw; // keywords
static const string keymd5; // file md5 checksum
static const string keybcknd; // backend type for data not from the filesys
// udi back from index. Only set by Rcl::Query::getdoc().
static const string keyudi;
};
+12
View File
@@ -369,6 +369,7 @@ bool Query::getDoc(int exti, Doc &doc)
Xapian::docid docid = 0;
int pc = 0;
string data;
string udi;
m_reason.erase();
for (int xaptries=0; xaptries < 2; xaptries++) {
try {
@@ -377,6 +378,16 @@ bool Query::getDoc(int exti, Doc &doc)
pc = m_nq->xmset.convert_to_percent(m_nq->xmset[xapi-first]);
data = xdoc.get_data();
m_reason.erase();
Chrono chron;
Xapian::TermIterator it = xdoc.termlist_begin();
it.skip_to("Q");
if (it != xdoc.termlist_end()) {
udi = *it;
if (!udi.empty())
udi = udi.substr(1);
}
LOGDEB2(("Query::getDoc: %d ms to get udi [%s]\n", chron.millis(),
udi.c_str()));
break;
} catch (Xapian::DatabaseModifiedError &error) {
// retry or end of loop
@@ -390,6 +401,7 @@ bool Query::getDoc(int exti, Doc &doc)
LOGERR(("Query::getDoc: %s\n", m_reason.c_str()));
return false;
}
doc.meta[Rcl::Doc::keyudi] = udi;
// Parse xapian document's data and populate doc fields
return m_db->m_ndb->dbDataToRclDoc(docid, data, doc, pc);
}