blob: 733556d809aa9097fa40c28338e841f42056eee6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
commit 5bdb32928dc3eabf482676bb039104d1137cf1fb
Author: Vishesh Handa <me@vhanda.in>
Date: Mon May 5 16:28:17 2014 +0200
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
diff --git a/src/xapian/xapiansearchstore.cpp b/src/xapian/xapiansearchstore.cpp
index a0529ce..1a59e3e 100644
--- a/src/xapian/xapiansearchstore.cpp
+++ b/src/xapian/xapiansearchstore.cpp
@@ -174,7 +174,7 @@ namespace {
Xapian::Query XapianSearchStore::constructSearchQuery(const QString& str)
{
QVector<Xapian::Query> queries;
- QRegExp splitRegex("[\\s.]");
+ QRegExp splitRegex("[\\s.+*/\\-=]");
QStringList list = str.split(splitRegex, QString::SkipEmptyParts);
QMutableListIterator<QString> iter(list);
|