Prevent error caused by trying to add a posting for an empty term (created by unac on really weird data)
This commit is contained in:
parent
494c57ee9c
commit
d68eacc172
2 changed files with 12 additions and 1 deletions
|
@ -677,6 +677,10 @@ public:
|
||||||
// and remember relative.
|
// and remember relative.
|
||||||
m_ts->curpos = pos;
|
m_ts->curpos = pos;
|
||||||
pos += m_ts->basepos;
|
pos += m_ts->basepos;
|
||||||
|
// Don't try to add empty term Xapian doesnt like it... Safety check
|
||||||
|
// this should not happen.
|
||||||
|
if (term.empty())
|
||||||
|
return true;
|
||||||
string ermsg;
|
string ermsg;
|
||||||
try {
|
try {
|
||||||
// Index without prefix, using the field-specific weighting
|
// Index without prefix, using the field-specific weighting
|
||||||
|
|
|
@ -131,7 +131,14 @@ public:
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return TermProc::takeword(otrm, pos, bs, be);
|
// It may happen in some weird cases that the output from unac is
|
||||||
|
// empty (if the word actually consisted entirely of diacritics ...)
|
||||||
|
// The consequence is that a phrase search won't work without addional
|
||||||
|
// slack.
|
||||||
|
if (otrm.empty())
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return TermProc::takeword(otrm, pos, bs, be);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool flush()
|
virtual bool flush()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue