diff --git a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp index 1004b8f2..4716ab22 100644 --- a/src/rcldb/searchdata.cpp +++ b/src/rcldb/searchdata.cpp @@ -666,8 +666,8 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db, #else if (o_index_stripchars) { - // If the index is raw, we can only come here if nostemexp is unset - // and we just need stem expansion. + // If the index is stripped, we can only come here if + // nostemexp is unset and we just need stem expansion. db.termMatch(Rcl::Db::ET_STEM, getStemLang(), term, res, maxexpand, m_field); goto termmatchtoresult; diff --git a/src/rcldb/stemdb.cpp b/src/rcldb/stemdb.cpp index c3d435e8..a08d2012 100644 --- a/src/rcldb/stemdb.cpp +++ b/src/rcldb/stemdb.cpp @@ -59,14 +59,16 @@ bool StemDb::stemExpand(const std::string& langs, const std::string& term, #ifndef RCL_INDEX_STRIPCHARS // Expand the unaccented stem if (!o_index_stripchars) { - for (vector::const_iterator it = llangs.begin(); - it != llangs.end(); it++) { - SynTermTransStem stemmer(*it); - XapComputableSynFamMember expander(getdb(), synFamStemUnac, - *it, &stemmer); - string unac; - unacmaybefold(term, unac, "UTF-8", UNACOP_UNAC); - (void)expander.synExpand(unac, result); + string unac; + unacmaybefold(term, unac, "UTF-8", UNACOP_UNAC); + if (term != unac) { + for (vector::const_iterator it = llangs.begin(); + it != llangs.end(); it++) { + SynTermTransStem stemmer(*it); + XapComputableSynFamMember expander(getdb(), synFamStemUnac, + *it, &stemmer); + (void)expander.synExpand(unac, result); + } } } #endif @@ -77,7 +79,7 @@ bool StemDb::stemExpand(const std::string& langs, const std::string& term, sort(result.begin(), result.end()); vector::iterator uit = unique(result.begin(), result.end()); result.resize(uit - result.begin()); - LOGDEB0(("stemExpand:%s: %s -> %s\n", langs.c_str(), term.c_str(), + LOGDEB1(("stemExpand:%s: %s -> %s\n", langs.c_str(), term.c_str(), stringsToString(result).c_str())); return true; } diff --git a/src/rcldb/synfamily.cpp b/src/rcldb/synfamily.cpp index a23bf3f7..9e857342 100644 --- a/src/rcldb/synfamily.cpp +++ b/src/rcldb/synfamily.cpp @@ -18,12 +18,13 @@ #include "autoconfig.h" +#include +#include + #include "debuglog.h" #include "xmacros.h" #include "synfamily.h" - -#include -#include +#include "smallut.h" using namespace std; @@ -175,7 +176,8 @@ bool XapComputableSynFamMember::synExpand(const string& term, result.push_back(root); } } - + LOGDEB(("XapCompSynFamMbr::synExpand([%s]): term [%s] -> [%s]\n", + m_prefix.c_str(), term.c_str(), stringsToString(result).c_str())); return true; }