mimetype T prefix was mishandled for a raw index

This commit is contained in:
Jean-Francois Dockes 2012-10-13 11:08:53 +02:00
parent a16746e5bb
commit 828b141469
3 changed files with 4 additions and 3 deletions

View file

@ -71,7 +71,7 @@ namespace Rcl {
// Some prefixes that we could get from the fields file, but are not going // Some prefixes that we could get from the fields file, but are not going
// to ever change. // to ever change.
static const string fileext_prefix = "XE"; static const string fileext_prefix = "XE";
static const string mimetype_prefix = "T"; const string mimetype_prefix = "T";
static const string xapday_prefix = "D"; static const string xapday_prefix = "D";
static const string xapmonth_prefix = "M"; static const string xapmonth_prefix = "M";
static const string xapyear_prefix = "Y"; static const string xapyear_prefix = "Y";

View file

@ -423,6 +423,7 @@ string version_string();
extern const string pathelt_prefix; extern const string pathelt_prefix;
extern const string udi_prefix; extern const string udi_prefix;
extern const string parent_prefix; extern const string parent_prefix;
extern const string mimetype_prefix;
#ifdef RCL_INDEX_STRIPCHARS #ifdef RCL_INDEX_STRIPCHARS
extern const string start_of_field_term; extern const string start_of_field_term;
extern const string end_of_field_term; extern const string end_of_field_term;

View file

@ -345,7 +345,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d, int maxexp, int maxcl)
Xapian::Query tq; Xapian::Query tq;
for (vector<string>::iterator it = m_filetypes.begin(); for (vector<string>::iterator it = m_filetypes.begin();
it != m_filetypes.end(); it++) { it != m_filetypes.end(); it++) {
string term = "T" + *it; string term = wrap_prefix(mimetype_prefix) + *it;
LOGDEB0(("Adding file type term: [%s]\n", term.c_str())); LOGDEB0(("Adding file type term: [%s]\n", term.c_str()));
tq = tq.empty() ? Xapian::Query(term) : tq = tq.empty() ? Xapian::Query(term) :
Xapian::Query(Xapian::Query::OP_OR, tq, Xapian::Query(term)); Xapian::Query(Xapian::Query::OP_OR, tq, Xapian::Query(term));
@ -360,7 +360,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d, int maxexp, int maxcl)
Xapian::Query tq; Xapian::Query tq;
for (vector<string>::iterator it = m_nfiletypes.begin(); for (vector<string>::iterator it = m_nfiletypes.begin();
it != m_nfiletypes.end(); it++) { it != m_nfiletypes.end(); it++) {
string term = "T" + *it; string term = wrap_prefix(mimetype_prefix) + *it;
LOGDEB0(("Adding negative file type term: [%s]\n", term.c_str())); LOGDEB0(("Adding negative file type term: [%s]\n", term.c_str()));
tq = tq.empty() ? Xapian::Query(term) : tq = tq.empty() ? Xapian::Query(term) :
Xapian::Query(Xapian::Query::OP_OR, tq, Xapian::Query(term)); Xapian::Query(Xapian::Query::OP_OR, tq, Xapian::Query(term));