doc.pc now only place where relevancy is stored

This commit is contained in:
dockes
2008-09-29 08:59:20 +00:00
parent 0bab0ea553
commit 828dff3bb1
18 changed files with 55 additions and 81 deletions
+5 -6
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.145 2008-09-16 08:18:30 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.146 2008-09-29 08:59:20 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -159,6 +159,7 @@ bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data,
}
char buf[20];
sprintf(buf,"%.2f", float(percent) / 100.0);
doc.pc = percent;
doc.meta[Doc::keyrr] = buf;
parms.get(Doc::keyipt, doc.ipath);
parms.get(Doc::keyfs, doc.fbytes);
@@ -1554,7 +1555,7 @@ bool Db::makeDocAbstract(Doc &doc, Query *query, string& abstract)
}
// Retrieve document defined by file name and internal path.
bool Db::getDoc(const string &udi, Doc &doc, int *pc)
bool Db::getDoc(const string &udi, Doc &doc)
{
LOGDEB(("Db:getDoc: [%s]\n", udi.c_str()));
if (m_ndb == 0)
@@ -1562,8 +1563,7 @@ bool Db::getDoc(const string &udi, Doc &doc, int *pc)
// Initialize what we can in any case. If this is history, caller
// will make partial display in case of error
if (*pc)
*pc = 100;
doc.pc = 100;
string uniterm = make_uniterm(udi);
string ermsg;
@@ -1572,8 +1572,7 @@ bool Db::getDoc(const string &udi, Doc &doc, int *pc)
// Document found in history no longer in the database.
// We return true (because their might be other ok docs further)
// but indicate the error with pc = -1
if (*pc)
*pc = -1;
doc.pc = -1;
LOGINFO(("Db:getDoc: no such doc in index: [%s] (len %d)\n",
uniterm.c_str(), uniterm.length()));
return true;
+2 -2
View File
@@ -16,7 +16,7 @@
*/
#ifndef _DB_H_INCLUDED_
#define _DB_H_INCLUDED_
/* @(#$Id: rcldb.h,v 1.62 2008-09-16 08:18:30 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: rcldb.h,v 1.63 2008-09-29 08:59:20 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
@@ -174,7 +174,7 @@ class Db {
*
* Used by the 'history' feature (and nothing else?)
*/
bool getDoc(const string &udi, Doc &doc, int *percent);
bool getDoc(const string &udi, Doc &doc);
/* The following are mainly for the aspell module */
/** Whole term list walking. */
+2 -4
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclquery.cpp,v 1.7 2008-09-29 06:58:25 dockes Exp $ (C) 2008 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclquery.cpp,v 1.8 2008-09-29 08:59:20 dockes Exp $ (C) 2008 J.F.Dockes";
#endif
#include <stdlib.h>
@@ -278,7 +278,7 @@ int Query::getResCnt()
// maintain a correspondance from the sequential external index
// sequence to the internal Xapian hole-y one (the holes being the documents
// that dont match the filter).
bool Query::getDoc(int exti, Doc &doc, int *percent)
bool Query::getDoc(int exti, Doc &doc)
{
LOGDEB1(("Query::getDoc: exti %d\n", exti));
if (ISNULL(m_nq) || !m_nq->enquire) {
@@ -364,8 +364,6 @@ bool Query::getDoc(int exti, Doc &doc, int *percent)
Xapian::Document xdoc = m_nq->mset[xapi-first].get_document();
Xapian::docid docid = *(m_nq->mset[xapi-first]);
int pc = m_nq->mset.convert_to_percent(m_nq->mset[xapi-first]);
if (percent)
*percent = pc;
// Parse xapian document's data and populate doc fields
string data = xdoc.get_data();
+2 -2
View File
@@ -1,6 +1,6 @@
#ifndef _rclquery_h_included_
#define _rclquery_h_included_
/* @(#$Id: rclquery.h,v 1.4 2008-09-29 06:58:25 dockes Exp $ (C) 2008 J.F.Dockes */
/* @(#$Id: rclquery.h,v 1.5 2008-09-29 08:59:20 dockes Exp $ (C) 2008 J.F.Dockes */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -70,7 +70,7 @@ class Query {
int getResCnt();
/** Get document at rank i in current query results. */
bool getDoc(int i, Doc &doc, int *percent = 0);
bool getDoc(int i, Doc &doc);
/** Get possibly expanded list of query terms */
bool getQueryTerms(list<string>& terms);