display more complete stats in spell window
This commit is contained in:
+16
-3
@@ -8,8 +8,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>298</width>
|
||||
<height>295</height>
|
||||
<width>400</width>
|
||||
<height>450</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -106,6 +106,19 @@
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>statsLBL</cstring>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>7</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No db info.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListView">
|
||||
<column>
|
||||
<property name="text">
|
||||
@@ -120,7 +133,7 @@
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Count</string>
|
||||
<string>Doc. / Tot.</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
|
||||
+17
-12
@@ -99,7 +99,7 @@ void SpellW::init()
|
||||
suggsLV->setSorting(100, false);
|
||||
#else
|
||||
QStringList labels(tr("Term"));
|
||||
labels.push_back(tr("Count"));
|
||||
labels.push_back(tr("Doc. / Tot."));
|
||||
suggsLV->setHorizontalHeaderLabels(labels);
|
||||
suggsLV->setShowGrid(0);
|
||||
suggsLV->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
|
||||
@@ -109,7 +109,7 @@ void SpellW::init()
|
||||
#endif
|
||||
|
||||
suggsLV->setColumnWidth(0, 200);
|
||||
suggsLV->setColumnWidth(1, 100);
|
||||
suggsLV->setColumnWidth(1, 150);
|
||||
}
|
||||
|
||||
#if (QT_VERSION < 0x040000)
|
||||
@@ -165,18 +165,22 @@ void SpellW::doExpand()
|
||||
case 2:mt = Rcl::Db::ET_STEM; break;
|
||||
}
|
||||
|
||||
list<Rcl::TermMatchEntry> entries;
|
||||
Rcl::TermMatchResult res;
|
||||
switch (expTypeCMB->currentItem()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2: {
|
||||
case 2:
|
||||
{
|
||||
string l_stemlang = stemLangCMB->currentText().ascii();
|
||||
|
||||
if (!rcldb->termMatch(mt, l_stemlang, expr, entries, 200)) {
|
||||
if (!rcldb->termMatch(mt, l_stemlang, expr, res, 200)) {
|
||||
LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
|
||||
return;
|
||||
}
|
||||
statsLBL->setText(tr("Index: %1 documents, average length %2 terms")
|
||||
.arg(res.dbdoccount).arg(res.dbavgdoclen, 0, 'f', 1));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
#ifdef RCL_USE_ASPELL
|
||||
@@ -197,13 +201,13 @@ void SpellW::doExpand()
|
||||
}
|
||||
for (list<string>::const_iterator it = suggs.begin();
|
||||
it != suggs.end(); it++)
|
||||
entries.push_back(Rcl::TermMatchEntry(*it));
|
||||
res.entries.push_back(Rcl::TermMatchEntry(*it));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (entries.empty()) {
|
||||
if (res.entries.empty()) {
|
||||
#if (QT_VERSION < 0x040000)
|
||||
new MyListViewItem(suggsLV, tr("No expansion found"), "");
|
||||
#else
|
||||
@@ -211,17 +215,18 @@ void SpellW::doExpand()
|
||||
#endif
|
||||
} else {
|
||||
#if (QT_VERSION < 0x040000)
|
||||
for (list<Rcl::TermMatchEntry>::reverse_iterator it = entries.rbegin();
|
||||
it != entries.rend(); it++) {
|
||||
for (list<Rcl::TermMatchEntry>::reverse_iterator it =
|
||||
res.entries.rbegin();
|
||||
it != res.entries.rend(); it++) {
|
||||
#else
|
||||
int row = 0;
|
||||
for (list<Rcl::TermMatchEntry>::iterator it = entries.begin();
|
||||
it != entries.end(); it++) {
|
||||
for (list<Rcl::TermMatchEntry>::iterator it = res.entries.begin();
|
||||
it != res.entries.end(); it++) {
|
||||
#endif
|
||||
LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
|
||||
char num[20];
|
||||
if (it->wcf)
|
||||
sprintf(num, "%d", it->wcf);
|
||||
sprintf(num, "%d / %d", it->docs, it->wcf);
|
||||
else
|
||||
num[0] = 0;
|
||||
#if (QT_VERSION < 0x040000)
|
||||
|
||||
@@ -233,17 +233,17 @@ void SSearch::completion()
|
||||
|
||||
// Query database
|
||||
const int max = 100;
|
||||
list<Rcl::TermMatchEntry> strs;
|
||||
Rcl::TermMatchResult tmres;
|
||||
string stemLang = (const char *)prefs.queryStemLang.ascii();
|
||||
if (stemLang == "ALL") {
|
||||
rclconfig->getConfParam("indexstemminglanguages", stemLang);
|
||||
}
|
||||
if (!rcldb->termMatch(Rcl::Db::ET_WILD, stemLang, s, strs, max) ||
|
||||
strs.size() == 0) {
|
||||
if (!rcldb->termMatch(Rcl::Db::ET_WILD, stemLang, s, tmres, max) ||
|
||||
tmres.entries.size() == 0) {
|
||||
QApplication::beep();
|
||||
return;
|
||||
}
|
||||
if (strs.size() == (unsigned int)max) {
|
||||
if (tmres.entries.size() == (unsigned int)max) {
|
||||
QMessageBox::warning(0, "Recoll", tr("Too many completions"));
|
||||
return;
|
||||
}
|
||||
@@ -251,13 +251,13 @@ void SSearch::completion()
|
||||
// If list from db is single word, insert it, else ask user to select
|
||||
QString res;
|
||||
bool ok = false;
|
||||
if (strs.size() == 1) {
|
||||
res = QString::fromUtf8(strs.begin()->term.c_str());
|
||||
if (tmres.entries.size() == 1) {
|
||||
res = QString::fromUtf8(tmres.entries.begin()->term.c_str());
|
||||
ok = true;
|
||||
} else {
|
||||
QStringList lst;
|
||||
for (list<Rcl::TermMatchEntry>::iterator it=strs.begin();
|
||||
it != strs.end(); it++) {
|
||||
for (list<Rcl::TermMatchEntry>::iterator it = tmres.entries.begin();
|
||||
it != tmres.entries.end(); it++) {
|
||||
lst.push_back(QString::fromUtf8(it->term.c_str()));
|
||||
}
|
||||
res = QInputDialog::getItem(tr("Completions"),
|
||||
|
||||
Reference in New Issue
Block a user