From ae6d758b346a83385794debd0b3a7ab370f62d06 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Fri, 11 Mar 2011 11:54:50 +0100 Subject: [PATCH] GUI: display estimated result count in status line --- src/VERSION | 2 +- src/qtgui/rclmain_w.cpp | 20 +++++++++++++++++++- src/qtgui/rclmain_w.h | 1 + src/rcldb/rclquery.cpp | 15 +++++++++------ src/rcldb/rclquery.h | 2 ++ website/release-1.15.html | 6 +++--- 6 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/VERSION b/src/VERSION index 545fd574..dda688a7 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -1.15.7 +1.15.8pre diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 00f2aaab..9ddfcbf6 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -241,7 +241,9 @@ void RclMain::init() this, SLOT(showUIPrefs())); connect(extIdxAction, SIGNAL(activated()), this, SLOT(showExtIdxDialog())); - + connect(this, SIGNAL(applyFiltSortData()), + this, SLOT(onResultsChanged())); + if (prefs.catgToolBar && catgCMB) connect(catgCMB, SIGNAL(activated(int)), this, SLOT(catgFilter(int))); @@ -621,6 +623,22 @@ void RclMain::startSearch(RefCntr sdata) QApplication::restoreOverrideCursor(); } +void RclMain::onResultsChanged() +{ + if (m_source.isNotNull()) { + int cnt = m_source->getResCnt(); + QString msg; + if (cnt > 0) { + QString str; + msg = tr("Result count (est.)") + ": " + + str.setNum(cnt); + } else { + msg = tr("No results found"); + } + statusBar()->showMessage(msg, 0); + } +} + void RclMain::resetSearch() { emit searchReset(); diff --git a/src/qtgui/rclmain_w.h b/src/qtgui/rclmain_w.h index 252aca5b..67f7e996 100644 --- a/src/qtgui/rclmain_w.h +++ b/src/qtgui/rclmain_w.h @@ -100,6 +100,7 @@ public slots: virtual void onResTableSortBy(DocSeqSortSpec); virtual void resultCount(int); virtual void showQueryDetails(); + virtual void onResultsChanged(); signals: void docSourceChanged(RefCntr); diff --git a/src/rcldb/rclquery.cpp b/src/rcldb/rclquery.cpp index a4440ab4..6aec6010 100644 --- a/src/rcldb/rclquery.cpp +++ b/src/rcldb/rclquery.cpp @@ -90,7 +90,7 @@ private: Query::Query(Db *db) : m_nq(new Native(this)), m_db(db), m_sorter(0), m_sortAscending(true), - m_collapseDuplicates(false) + m_collapseDuplicates(false), m_resCnt(-1) { } @@ -136,6 +136,7 @@ bool Query::setQuery(RefCntr sdata) LOGERR(("Query::setQuery: not initialised!\n")); return false; } + m_resCnt = -1; m_reason.erase(); m_nq->clear(); @@ -258,23 +259,25 @@ int Query::getResCnt() LOGERR(("Query::getResCnt: no query opened\n")); return -1; } + if (m_resCnt >= 0) + return m_resCnt; - int ret = -1; + m_resCnt = -1; if (m_nq->xmset.size() <= 0) { Chrono chron; XAPTRY(m_nq->xmset = - m_nq->xenquire->get_mset(0, qquantum, (const Xapian::RSet *)0); - ret = m_nq->xmset.get_matches_lower_bound(), + m_nq->xenquire->get_mset(0, qquantum, 1000); + m_resCnt = m_nq->xmset.get_matches_lower_bound(), m_db->m_ndb->xrdb, m_reason); LOGDEB(("Query::getResCnt: %d mS\n", chron.millis())); if (!m_reason.empty()) LOGERR(("xenquire->get_mset: exception: %s\n", m_reason.c_str())); } else { - ret = m_nq->xmset.get_matches_lower_bound(); + m_resCnt = m_nq->xmset.get_matches_lower_bound(); } - return ret; + return m_resCnt; } diff --git a/src/rcldb/rclquery.h b/src/rcldb/rclquery.h index 87dd092a..fea706cf 100644 --- a/src/rcldb/rclquery.h +++ b/src/rcldb/rclquery.h @@ -96,6 +96,8 @@ private: string m_sortField; bool m_sortAscending; bool m_collapseDuplicates; + int m_resCnt; + /* Copyconst and assignement private and forbidden */ Query(const Query &) {} Query & operator=(const Query &) {return *this;}; diff --git a/website/release-1.15.html b/website/release-1.15.html index a8ce8f37..31cbe3d9 100644 --- a/website/release-1.15.html +++ b/website/release-1.15.html @@ -74,9 +74,9 @@ relatively minor, features (ie: duplicates collapsing) depend on a full index rebuild. The 1.14 date search feature does not need an index rebuild, the data was already in - the index. The new 1.15 table will not be able to display - filenames without a full reindex (it does display the urls), - except for some previous custom field configurations.

+ the index. The new 1.15 table will not be able to display + filenames without a full reindex (it does display the urls), + except for some previous custom field configurations.


If installing over 1.10 or older, you need a full rebuild. The best way to do this is to just delete the old