Turn synonyms expansion off if the search is sensitive to either case or diacritics. + misc trace improvements

This commit is contained in:
Jean-Francois Dockes 2015-09-01 08:13:11 +02:00
parent aa676151a5
commit a0d7c41888
6 changed files with 28 additions and 11 deletions

View file

@ -66,6 +66,7 @@ src/filters/rclexecm.pyc
src/filters/rcllatinclass.pyc src/filters/rcllatinclass.pyc
src/recollindex src/recollindex
src/recollq src/recollq
src/xadump
src/kde/kioslave/kio_recoll/builddir src/kde/kioslave/kio_recoll/builddir
src/python/recoll/build src/python/recoll/build
src/python/recoll/recoll/__init__.pyc src/python/recoll/recoll/__init__.pyc

View file

@ -43,6 +43,14 @@ public:
: m_op(op) : m_op(op)
{ {
} }
virtual std::string name() {
std::string nm("Unac: ");
if (m_op & UNACOP_UNAC)
nm += "UNAC ";
if (m_op & UNACOP_FOLD)
nm += "FOLD ";
return nm;
}
virtual std::string operator()(const std::string& in) virtual std::string operator()(const std::string& in)
{ {
string out; string out;

View file

@ -258,6 +258,8 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
} }
if (matchtyp == ET_STEM || (typ_sens & ET_SYNEXP)) { if (matchtyp == ET_STEM || (typ_sens & ET_SYNEXP)) {
// Note: if any of the above conds is true, we are insensitive to
// diacs and case (enforced in searchdatatox:termexpand
// Need stem expansion. Lowercase the result of accent and case // Need stem expansion. Lowercase the result of accent and case
// expansion for input to stemdb. // expansion for input to stemdb.
for (unsigned int i = 0; i < lexp.size(); i++) { for (unsigned int i = 0; i < lexp.size(); i++) {
@ -316,14 +318,14 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
// Expand the resulting list for case (all stemdb content // Expand the resulting list for case (all stemdb content
// is lowercase) // is lowercase)
vector<string> exp1; vector<string> exp1;
for (vector<string>::const_iterator it = lexp.begin(); for (vector<string>::const_iterator it = lexp.begin();
it != lexp.end(); it++) { it != lexp.end(); it++) {
synac.synExpand(*it, exp1); synac.synExpand(*it, exp1);
} }
exp1.swap(lexp); exp1.swap(lexp);
sort(lexp.begin(), lexp.end()); sort(lexp.begin(), lexp.end());
lexp.erase(unique(lexp.begin(), lexp.end()), lexp.end()); lexp.erase(unique(lexp.begin(), lexp.end()), lexp.end());
} }
// Filter the result and get the stats, possibly add prefixes. // Filter the result and get the stats, possibly add prefixes.

View file

@ -464,8 +464,10 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
// If we are sensitive to case or diacritics turn stemming off // If we are sensitive to case or diacritics turn stemming off
if (diac_sensitive || case_sensitive) { if (diac_sensitive || case_sensitive) {
LOGDEB0(("expandTerm: diac or case sens set -> stemexpand off\n")); LOGDEB0(("expandTerm: diac or case sens set -> "
"stemexpand and synonyms off\n"));
nostemexp = true; nostemexp = true;
synonyms = false;
} }
if (!case_sensitive || !diac_sensitive) if (!case_sensitive || !diac_sensitive)

View file

@ -144,8 +144,11 @@ bool XapComputableSynFamMember::synExpand(const string& term,
string key = m_prefix + root; string key = m_prefix + root;
LOGDEB(("XapCompSynFamMbr::synExpand([%s]): term [%s] root [%s] \n", LOGDEB(("XapCompSynFamMbr::synExpand([%s]): term [%s] root [%s] "
m_prefix.c_str(), term.c_str(), root.c_str())); "m_trans: %s filter: %s\n",
m_prefix.c_str(), term.c_str(), root.c_str(),
m_trans->name().c_str(),
filtertrans ? filtertrans->name().c_str() : "none"));
string ermsg; string ermsg;
try { try {

View file

@ -118,6 +118,7 @@ protected:
class SynTermTrans { class SynTermTrans {
public: public:
virtual std::string operator()(const std::string&) = 0; virtual std::string operator()(const std::string&) = 0;
virtual std::string name() { return "SynTermTrans: unknown";}
}; };
/** A member (set of root-synonyms associations) of a SynFamily for /** A member (set of root-synonyms associations) of a SynFamily for