From 702fb88a1ed37e70c6a70e01c07993e8af33172e Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Fri, 30 Sep 2011 08:50:50 +0200 Subject: [PATCH] Search: remove restriction on empty queries by replacing empty query with Xapian::Query::Matchall. This allows querying all files of a given type, or under a given tree, without an actual text search part --- src/rcldb/searchdata.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp index f7e3e0eb..0b8b7a01 100644 --- a/src/rcldb/searchdata.cpp +++ b/src/rcldb/searchdata.cpp @@ -170,11 +170,6 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d) Xapian::Query xq; m_reason.erase(); - if (!m_query.size() && !m_haveDates) { - m_reason = "empty query"; - return false; - } - // Walk the clause list translating each in turn and building the // Xapian query tree for (qlist_it_t it = m_query.begin(); it != m_query.end(); it++) { @@ -210,7 +205,9 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d) xq = Xapian::Query(op, xq, nq); } } - + if (xq.empty()) + xq = Xapian::Query::MatchAll; + if (m_haveDates) { // If one of the extremities is unset, compute db extremas if (m_dates.y1 == 0 || m_dates.y2 == 0) {