Commit 5bdb3292 authored by Vishesh Handa's avatar Vishesh Handa
Browse files

XapianSearchStore: Split the string based on + * / - =

When we receive a search string, we typically split it up by spaces and
dots. Then each sub string is checked, if it is <= 3 characters, we use
our own expansion scheme (imperfect) otherwise xapians.

We need to use our own completion scheme because xapian's consumes too
much memory in the case of very few characters. It basically expands the
string to every possible completion result it has in its db, this
results in loads and loads of memory being consumed.

We now split based on some extra characters so that when searching for
'2*2=' will not consume all your RAM in the case when your DB has many
words starting with 2.

BUG: 332253
FIXED-IN: 4.13.1
parent 877e57a1
...@@ -174,7 +174,7 @@ namespace { ...@@ -174,7 +174,7 @@ namespace {
Xapian::Query XapianSearchStore::constructSearchQuery(const QString& str) Xapian::Query XapianSearchStore::constructSearchQuery(const QString& str)
{ {
QVector<Xapian::Query> queries; QVector<Xapian::Query> queries;
QRegExp splitRegex("[\\s.]"); QRegExp splitRegex("[\\s.+*/\\-=]");
QStringList list = str.split(splitRegex, QString::SkipEmptyParts); QStringList list = str.split(splitRegex, QString::SkipEmptyParts);
QMutableListIterator<QString> iter(list); QMutableListIterator<QString> iter(list);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment