diff --git a/src/common/textsplit.cpp b/src/common/textsplit.cpp index 7afd163f..d0431d46 100644 --- a/src/common/textsplit.cpp +++ b/src/common/textsplit.cpp @@ -18,10 +18,10 @@ #include "autoconfig.h" #include +#include #include #include -//#include #include using std::tr1::unordered_set; @@ -102,11 +102,7 @@ public: for (i = 0; i < sizeof(uniignblocks) / sizeof(int); i++) { vignblocks.push_back(uniignblocks[i]); } - if (vignblocks.size() % 2) { - LOGFATAL(("Fatal internal error: unicode ign blocks array " - "size not even\n")); - abort(); - } + assert((vignblocks.size() % 2) == 0); for (i = 0; i < sizeof(avsbwht) / sizeof(int); i++) { visiblewhite.insert(avsbwht[i]); diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index da2deed5..d98ff157 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -76,6 +76,11 @@ static const string xapday_prefix = "D"; static const string xapmonth_prefix = "M"; static const string xapyear_prefix = "Y"; const string pathelt_prefix = "XP"; +const string udi_prefix("Q"); +const string parent_prefix("F"); + +// Special terms to mark begin/end of field (for anchored searches), and +// page breaks #ifdef RCL_INDEX_STRIPCHARS const string start_of_field_term = "XXST"; const string end_of_field_term = "XXND"; @@ -104,7 +109,7 @@ static const string cstr_syntAbs("?!#@"); // "Q" + external udi static inline string make_uniterm(const string& udi) { - string uniterm(wrap_prefix("Q")); + string uniterm(wrap_prefix(udi_prefix)); uniterm.append(udi); return uniterm; } @@ -116,7 +121,7 @@ static inline string make_parentterm(const string& udi) // I prefer to be in possible conflict with omega than with // user-defined fields (Xxxx) that we also allow. "F" is currently // not used by omega (2008-07) - string pterm(wrap_prefix("F")); + string pterm(wrap_prefix(parent_prefix)); pterm.append(udi); return pterm; } diff --git a/src/rcldb/rcldb.h b/src/rcldb/rcldb.h index 7daf5a49..283033a0 100644 --- a/src/rcldb/rcldb.h +++ b/src/rcldb/rcldb.h @@ -398,6 +398,8 @@ private: string version_string(); extern const string pathelt_prefix; +extern const string udi_prefix; +extern const string parent_prefix; #ifdef RCL_INDEX_STRIPCHARS extern const string start_of_field_term; extern const string end_of_field_term; diff --git a/src/rcldb/rclquery.cpp b/src/rcldb/rclquery.cpp index 2e6fffac..0ac5948e 100644 --- a/src/rcldb/rclquery.cpp +++ b/src/rcldb/rclquery.cpp @@ -454,11 +454,11 @@ bool Query::getDoc(int xapi, Doc &doc) m_reason.erase(); Chrono chron; Xapian::TermIterator it = xdoc.termlist_begin(); - it.skip_to("Q"); + it.skip_to(wrap_prefix(udi_prefix)); if (it != xdoc.termlist_end()) { udi = *it; if (!udi.empty()) - udi = udi.substr(1); + udi = udi.substr(wrap_prefix(udi_prefix).size()); } LOGDEB2(("Query::getDoc: %d ms for udi [%s], collapse count %d\n", chron.millis(), udi.c_str(), collapsecount));