summaryrefslogtreecommitdiffstats
path: root/common/fulltextindex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/fulltextindex.cpp')
-rw-r--r--common/fulltextindex.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/common/fulltextindex.cpp b/common/fulltextindex.cpp
index abe29f5..e57a562 100644
--- a/common/fulltextindex.cpp
+++ b/common/fulltextindex.cpp
@@ -170,9 +170,24 @@ QVector<QByteArray> FulltextIndex::lookup(const QString &searchTerm)
170 Xapian::Enquire enquire(*mDb); 170 Xapian::Enquire enquire(*mDb);
171 enquire.set_query(query); 171 enquire.set_query(query);
172 172
173 const auto limit = searchTerm.size() <= 4 ? 1000 : 10000; 173 const auto limit = [&] {
174 switch (searchTerm.size()) {
175 case 1:
176 case 2:
177 case 3:
178 return 500;
179 case 4:
180 return 5000;
181 default:
182 return 20000;
183 }
184 }();
174 Xapian::MSet mset = enquire.get_mset(0, limit); 185 Xapian::MSet mset = enquire.get_mset(0, limit);
175 SinkTrace() << "Found " << mset.size() << " results, limited to " << limit; 186 SinkTrace() << "Found " << mset.size() << " results, limited to " << limit;
187 //Print a hint why a query could lack some expected results.
188 if (searchTerm.size() > 4 && mset.size() >= limit) {
189 SinkLog() << "Result set exceeding limit of " << limit << QString::fromStdString(query.get_description());
190 }
176 for (Xapian::MSetIterator it = mset.begin(); it != mset.end(); it++) { 191 for (Xapian::MSetIterator it = mset.begin(); it != mset.end(); it++) {
177 auto doc = it.get_document(); 192 auto doc = it.get_document();
178 const auto data = doc.get_value(0); 193 const auto data = doc.get_value(0);