do not include excluded terms in the highlight information data
This commit is contained in:
parent
e1b98c1e22
commit
83da93cab9
@ -493,7 +493,7 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (noexpansion) {
|
if (!m_exclude && noexpansion) {
|
||||||
oexp.push_back(prefix + term);
|
oexp.push_back(prefix + term);
|
||||||
m_hldata.terms[term] = term;
|
m_hldata.terms[term] = term;
|
||||||
LOGDEB("ExpandTerm: noexpansion: final: "<<stringsToString(oexp)<< "\n");
|
LOGDEB("ExpandTerm: noexpansion: final: "<<stringsToString(oexp)<< "\n");
|
||||||
@ -533,8 +533,10 @@ bool SearchDataClauseSimple::expandTerm(Rcl::Db &db,
|
|||||||
oexp.push_back(prefix + term);
|
oexp.push_back(prefix + term);
|
||||||
|
|
||||||
// Remember the uterm-to-expansion links
|
// Remember the uterm-to-expansion links
|
||||||
for (const auto& entry : oexp) {
|
if (!m_exclude) {
|
||||||
m_hldata.terms[strip_prefix(entry)] = term;
|
for (const auto& entry : oexp) {
|
||||||
|
m_hldata.terms[strip_prefix(entry)] = term;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LOGDEB("ExpandTerm: final: " << stringsToString(oexp) << "\n");
|
LOGDEB("ExpandTerm: final: " << stringsToString(oexp) << "\n");
|
||||||
return true;
|
return true;
|
||||||
@ -569,11 +571,13 @@ void SearchDataClauseSimple::processSimpleSpan(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Set up the highlight data. No prefix should go in there
|
// Set up the highlight data. No prefix should go in there
|
||||||
for (const auto& term : exp) {
|
if (!m_exclude) {
|
||||||
HighlightData::TermGroup tg;
|
for (const auto& term : exp) {
|
||||||
tg.term = term.substr(prefix.size());
|
HighlightData::TermGroup tg;
|
||||||
tg.grpsugidx = m_hldata.ugroups.size() - 1;
|
tg.term = term.substr(prefix.size());
|
||||||
m_hldata.index_term_groups.push_back(tg);
|
tg.grpsugidx = m_hldata.ugroups.size() - 1;
|
||||||
|
m_hldata.index_term_groups.push_back(tg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push either term or OR of stem-expanded set
|
// Push either term or OR of stem-expanded set
|
||||||
@ -703,14 +707,16 @@ void SearchDataClauseSimple::processPhraseOrNear(Rcl::Db &db, string& ermsg,
|
|||||||
|
|
||||||
// Insert the search groups and slacks in the highlight data, with
|
// Insert the search groups and slacks in the highlight data, with
|
||||||
// a reference to the user entry that generated them:
|
// a reference to the user entry that generated them:
|
||||||
HighlightData::TermGroup tg;
|
if (!m_exclude) {
|
||||||
tg.orgroups = groups;
|
HighlightData::TermGroup tg;
|
||||||
tg.slack = slack;
|
tg.orgroups = groups;
|
||||||
tg.grpsugidx = m_hldata.ugroups.size() - 1;
|
tg.slack = slack;
|
||||||
tg.kind = (op == Xapian::Query::OP_PHRASE) ?
|
tg.grpsugidx = m_hldata.ugroups.size() - 1;
|
||||||
HighlightData::TermGroup::TGK_PHRASE :
|
tg.kind = (op == Xapian::Query::OP_PHRASE) ?
|
||||||
HighlightData::TermGroup::TGK_NEAR;
|
HighlightData::TermGroup::TGK_PHRASE :
|
||||||
m_hldata.index_term_groups.push_back(tg);
|
HighlightData::TermGroup::TGK_NEAR;
|
||||||
|
m_hldata.index_term_groups.push_back(tg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trim string beginning with ^ or ending with $ and convert to flags
|
// Trim string beginning with ^ or ending with $ and convert to flags
|
||||||
@ -828,13 +834,17 @@ bool SearchDataClauseSimple::processUserString(Rcl::Db &db, const string &iq,
|
|||||||
int lmods = mods;
|
int lmods = mods;
|
||||||
if (tpq.nostemexps().front())
|
if (tpq.nostemexps().front())
|
||||||
lmods |= SearchDataClause::SDCM_NOSTEMMING;
|
lmods |= SearchDataClause::SDCM_NOSTEMMING;
|
||||||
m_hldata.ugroups.push_back(tpq.terms());
|
if (!m_exclude) {
|
||||||
|
m_hldata.ugroups.push_back(tpq.terms());
|
||||||
|
}
|
||||||
processSimpleSpan(db, ermsg, tpq.terms().front(),
|
processSimpleSpan(db, ermsg, tpq.terms().front(),
|
||||||
lmods, &pqueries);
|
lmods, &pqueries);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_hldata.ugroups.push_back(tpq.terms());
|
if (!m_exclude) {
|
||||||
|
m_hldata.ugroups.push_back(tpq.terms());
|
||||||
|
}
|
||||||
processPhraseOrNear(db, ermsg, &tpq, mods, &pqueries,
|
processPhraseOrNear(db, ermsg, &tpq, mods, &pqueries,
|
||||||
useNear, slack);
|
useNear, slack);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user