From bfeb681574cd058ac9e71b42aa8aeb84d5aec085 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sat, 13 Oct 2012 11:08:53 +0200 Subject: [PATCH] mimetype T prefix was mishandled for a raw index --- src/rcldb/rcldb.cpp | 2 +- src/rcldb/rcldb.h | 1 + src/rcldb/searchdata.cpp | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index 6db2c2c8..e20ab530 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -71,7 +71,7 @@ namespace Rcl { // Some prefixes that we could get from the fields file, but are not going // to ever change. 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 xapmonth_prefix = "M"; static const string xapyear_prefix = "Y"; diff --git a/src/rcldb/rcldb.h b/src/rcldb/rcldb.h index e930e4b8..20b9e426 100644 --- a/src/rcldb/rcldb.h +++ b/src/rcldb/rcldb.h @@ -423,6 +423,7 @@ string version_string(); extern const string pathelt_prefix; extern const string udi_prefix; extern const string parent_prefix; +extern const string mimetype_prefix; #ifdef RCL_INDEX_STRIPCHARS extern const string start_of_field_term; extern const string end_of_field_term; diff --git a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp index 61b35328..b7bf08a0 100644 --- a/src/rcldb/searchdata.cpp +++ b/src/rcldb/searchdata.cpp @@ -345,7 +345,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d, int maxexp, int maxcl) Xapian::Query tq; for (vector::iterator it = m_filetypes.begin(); 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())); tq = tq.empty() ? 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; for (vector::iterator it = m_nfiletypes.begin(); 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())); tq = tq.empty() ? Xapian::Query(term) : Xapian::Query(Xapian::Query::OP_OR, tq, Xapian::Query(term));