GUI: display estimated result count in status line

This commit is contained in:
Jean-Francois Dockes 2011-03-11 11:54:50 +01:00
parent afde2f9c2a
commit ae6d758b34
6 changed files with 35 additions and 11 deletions

View File

@ -1 +1 @@
1.15.7
1.15.8pre

View File

@ -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<Rcl::SearchData> 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();

View File

@ -100,6 +100,7 @@ public slots:
virtual void onResTableSortBy(DocSeqSortSpec);
virtual void resultCount(int);
virtual void showQueryDetails();
virtual void onResultsChanged();
signals:
void docSourceChanged(RefCntr<DocSequence>);

View File

@ -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<SearchData> 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;
}

View File

@ -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;};

View File

@ -74,9 +74,9 @@
relatively minor, features (ie: duplicates collapsing) depend
on a full index rebuild. The 1.14 date search feature
does <i>not</i> 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.</p>
the index. <i>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</i>.</p>
<br />If installing over 1.10 or older, you need a full
rebuild. The best way to do this is to just delete the old