stemdb: only need to expand the unac'd term if it differs from raw + comments and traces
This commit is contained in:
parent
499f28a166
commit
7115be2440
@ -666,8 +666,8 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
if (o_index_stripchars) {
|
if (o_index_stripchars) {
|
||||||
// If the index is raw, we can only come here if nostemexp is unset
|
// If the index is stripped, we can only come here if
|
||||||
// and we just need stem expansion.
|
// nostemexp is unset and we just need stem expansion.
|
||||||
db.termMatch(Rcl::Db::ET_STEM, getStemLang(), term, res,
|
db.termMatch(Rcl::Db::ET_STEM, getStemLang(), term, res,
|
||||||
maxexpand, m_field);
|
maxexpand, m_field);
|
||||||
goto termmatchtoresult;
|
goto termmatchtoresult;
|
||||||
|
|||||||
@ -59,14 +59,16 @@ bool StemDb::stemExpand(const std::string& langs, const std::string& term,
|
|||||||
#ifndef RCL_INDEX_STRIPCHARS
|
#ifndef RCL_INDEX_STRIPCHARS
|
||||||
// Expand the unaccented stem
|
// Expand the unaccented stem
|
||||||
if (!o_index_stripchars) {
|
if (!o_index_stripchars) {
|
||||||
for (vector<string>::const_iterator it = llangs.begin();
|
string unac;
|
||||||
it != llangs.end(); it++) {
|
unacmaybefold(term, unac, "UTF-8", UNACOP_UNAC);
|
||||||
SynTermTransStem stemmer(*it);
|
if (term != unac) {
|
||||||
XapComputableSynFamMember expander(getdb(), synFamStemUnac,
|
for (vector<string>::const_iterator it = llangs.begin();
|
||||||
*it, &stemmer);
|
it != llangs.end(); it++) {
|
||||||
string unac;
|
SynTermTransStem stemmer(*it);
|
||||||
unacmaybefold(term, unac, "UTF-8", UNACOP_UNAC);
|
XapComputableSynFamMember expander(getdb(), synFamStemUnac,
|
||||||
(void)expander.synExpand(unac, result);
|
*it, &stemmer);
|
||||||
|
(void)expander.synExpand(unac, result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -77,7 +79,7 @@ bool StemDb::stemExpand(const std::string& langs, const std::string& term,
|
|||||||
sort(result.begin(), result.end());
|
sort(result.begin(), result.end());
|
||||||
vector<string>::iterator uit = unique(result.begin(), result.end());
|
vector<string>::iterator uit = unique(result.begin(), result.end());
|
||||||
result.resize(uit - result.begin());
|
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()));
|
stringsToString(result).c_str()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,12 +18,13 @@
|
|||||||
|
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "xmacros.h"
|
#include "xmacros.h"
|
||||||
#include "synfamily.h"
|
#include "synfamily.h"
|
||||||
|
#include "smallut.h"
|
||||||
#include <iostream>
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -175,7 +176,8 @@ bool XapComputableSynFamMember::synExpand(const string& term,
|
|||||||
result.push_back(root);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user