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

This commit is contained in:
Jean-Francois Dockes 2011-09-30 08:50:50 +02:00
parent 383468e2fc
commit 702fb88a1e

View File

@ -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) {