From ce1042b397a11649ccc87293ef765fb3969e7799 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 27 Jul 2018 17:15:01 +0200 Subject: Debug messages and a higher limit for queries --- common/fulltextindex.cpp | 7 ++++--- tests/querytest.cpp | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/fulltextindex.cpp b/common/fulltextindex.cpp index 589feda..cc7fecf 100644 --- a/common/fulltextindex.cpp +++ b/common/fulltextindex.cpp @@ -166,13 +166,14 @@ QVector FulltextIndex::lookup(const QString &searchTerm) parser.set_database(*mDb); parser.set_max_expansion(100, Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT, Xapian::QueryParser::FLAG_PARTIAL); auto query = parser.parse_query(searchTerm.toStdString(), Xapian::QueryParser::FLAG_PHRASE|Xapian::QueryParser::FLAG_BOOLEAN|Xapian::QueryParser::FLAG_LOVEHATE|Xapian::QueryParser::FLAG_PARTIAL); + SinkTrace() << "Running xapian query: " << QString::fromStdString(query.get_description()); Xapian::Enquire enquire(*mDb); enquire.set_query(query); - auto limit = 1000; + const auto limit = searchTerm.size() <= 4 ? 1000 : 10000; Xapian::MSet mset = enquire.get_mset(0, limit); - Xapian::MSetIterator it = mset.begin(); - for (;it != mset.end(); it++) { + SinkTrace() << "Result set: " << QString::fromStdString(mset.get_description()); + for (Xapian::MSetIterator it = mset.begin(); it != mset.end(); it++) { auto doc = it.get_document(); const auto data = doc.get_value(0); results << QByteArray{data.c_str(), int(data.length())}; diff --git a/tests/querytest.cpp b/tests/querytest.cpp index ea3d8c6..8d60930 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp @@ -1520,12 +1520,11 @@ private slots: { auto msg = KMime::Message::Ptr::create(); msg->subject()->from7BitString("Subject To Search"); - msg->setBody("This is the searchable body bar."); + msg->setBody("This is the searchable body bar. unique sender2"); msg->from()->from7BitString("\"The Sender\""); msg->to()->from7BitString("\"Foo Bar\""); msg->assemble(); - // Mail mail("sink.dummy.instance1"); auto mail = ApplicationDomainType::createEntity("sink.dummy.instance1"); mail.setExtractedMessageId("test1"); mail.setFolder("folder1"); -- cgit v1.2.3