Turn synonyms expansion off if the search is sensitive to either case or diacritics. + misc trace improvements
This commit is contained in:
parent
aa676151a5
commit
a0d7c41888
6 changed files with 28 additions and 11 deletions
|
@ -66,6 +66,7 @@ src/filters/rclexecm.pyc
|
|||
src/filters/rcllatinclass.pyc
|
||||
src/recollindex
|
||||
src/recollq
|
||||
src/xadump
|
||||
src/kde/kioslave/kio_recoll/builddir
|
||||
src/python/recoll/build
|
||||
src/python/recoll/recoll/__init__.pyc
|
||||
|
|
|
@ -43,6 +43,14 @@ public:
|
|||
: 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)
|
||||
{
|
||||
string out;
|
||||
|
|
|
@ -258,6 +258,8 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
|
|||
}
|
||||
|
||||
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
|
||||
// expansion for input to stemdb.
|
||||
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
|
||||
// is lowercase)
|
||||
vector<string> exp1;
|
||||
for (vector<string>::const_iterator it = lexp.begin();
|
||||
it != lexp.end(); it++) {
|
||||
synac.synExpand(*it, exp1);
|
||||
}
|
||||
exp1.swap(lexp);
|
||||
sort(lexp.begin(), lexp.end());
|
||||
lexp.erase(unique(lexp.begin(), lexp.end()), lexp.end());
|
||||
vector<string> exp1;
|
||||
for (vector<string>::const_iterator it = lexp.begin();
|
||||
it != lexp.end(); it++) {
|
||||
synac.synExpand(*it, exp1);
|
||||
}
|
||||
exp1.swap(lexp);
|
||||
sort(lexp.begin(), lexp.end());
|
||||
lexp.erase(unique(lexp.begin(), lexp.end()), lexp.end());
|
||||
}
|
||||
|
||||
// Filter the result and get the stats, possibly add prefixes.
|
||||
|
|
|
@ -464,8 +464,10 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
|
|||
|
||||
// If we are sensitive to case or diacritics turn stemming off
|
||||
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;
|
||||
synonyms = false;
|
||||
}
|
||||
|
||||
if (!case_sensitive || !diac_sensitive)
|
||||
|
|
|
@ -144,8 +144,11 @@ bool XapComputableSynFamMember::synExpand(const string& term,
|
|||
|
||||
string key = m_prefix + root;
|
||||
|
||||
LOGDEB(("XapCompSynFamMbr::synExpand([%s]): term [%s] root [%s] \n",
|
||||
m_prefix.c_str(), term.c_str(), root.c_str()));
|
||||
LOGDEB(("XapCompSynFamMbr::synExpand([%s]): term [%s] root [%s] "
|
||||
"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;
|
||||
try {
|
||||
|
|
|
@ -118,6 +118,7 @@ protected:
|
|||
class SynTermTrans {
|
||||
public:
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue