|
a/src/qtgui/spell_w.cpp |
|
b/src/qtgui/spell_w.cpp |
|
... |
|
... |
117 |
|
117 |
|
118 |
resTW->setColumnWidth(0, 200);
|
118 |
resTW->setColumnWidth(0, 200);
|
119 |
resTW->setColumnWidth(1, 150);
|
119 |
resTW->setColumnWidth(1, 150);
|
120 |
resTW->installEventFilter(this);
|
120 |
resTW->installEventFilter(this);
|
121 |
|
121 |
|
|
|
122 |
bool stripped = false;
|
|
|
123 |
#ifdef RCL_INDEX_STRIPCHARS
|
|
|
124 |
stripped = true;
|
|
|
125 |
#else
|
|
|
126 |
stripped = o_index_stripchars;
|
|
|
127 |
#endif
|
|
|
128 |
if (stripped) {
|
|
|
129 |
caseSensCB->setEnabled(false);
|
|
|
130 |
caseSensCB->setEnabled(false);
|
|
|
131 |
}
|
122 |
modeSet(cmbidx);
|
132 |
modeSet(cmbidx);
|
123 |
}
|
133 |
}
|
124 |
|
134 |
|
125 |
static const int maxexpand = 10000;
|
135 |
static const int maxexpand = 10000;
|
126 |
|
136 |
|
|
... |
|
... |
142 |
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
|
152 |
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
|
143 |
LOGDEB(("SpellW::doExpand: db error: %s\n", reason.c_str()));
|
153 |
LOGDEB(("SpellW::doExpand: db error: %s\n", reason.c_str()));
|
144 |
return;
|
154 |
return;
|
145 |
}
|
155 |
}
|
146 |
|
156 |
|
147 |
Rcl::Db::MatchType mt;
|
157 |
int mt;
|
148 |
switch(mode) {
|
158 |
switch(mode) {
|
149 |
case TYPECMB_WILD: mt = Rcl::Db::ET_WILD; break;
|
159 |
case TYPECMB_WILD: mt = Rcl::Db::ET_WILD; break;
|
150 |
case TYPECMB_REG: mt = Rcl::Db::ET_REGEXP; break;
|
160 |
case TYPECMB_REG: mt = Rcl::Db::ET_REGEXP; break;
|
151 |
case TYPECMB_STEM: mt = Rcl::Db::ET_STEM; break;
|
161 |
case TYPECMB_STEM: mt = Rcl::Db::ET_STEM; break;
|
152 |
default: mt = Rcl::Db::ET_WILD;
|
162 |
default: mt = Rcl::Db::ET_WILD;
|
153 |
}
|
163 |
}
|
154 |
|
164 |
if (caseSensCB->isChecked()) {
|
|
|
165 |
mt |= Rcl::Db::ET_CASESENS;
|
|
|
166 |
}
|
|
|
167 |
if (diacSensCB->isChecked()) {
|
|
|
168 |
mt |= Rcl::Db::ET_DIACSENS;
|
|
|
169 |
}
|
155 |
Rcl::TermMatchResult res;
|
170 |
Rcl::TermMatchResult res;
|
156 |
string expr = string((const char *)baseWordLE->text().toUtf8());
|
171 |
string expr = string((const char *)baseWordLE->text().toUtf8());
|
|
|
172 |
Rcl::DbStats dbs;
|
|
|
173 |
rcldb->dbStats(dbs);
|
157 |
|
174 |
|
158 |
switch (mode) {
|
175 |
switch (mode) {
|
159 |
case TYPECMB_WILD:
|
176 |
case TYPECMB_WILD:
|
160 |
default:
|
177 |
default:
|
161 |
case TYPECMB_REG:
|
178 |
case TYPECMB_REG:
|
|
... |
|
... |
167 |
LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
|
184 |
LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
|
168 |
return;
|
185 |
return;
|
169 |
}
|
186 |
}
|
170 |
statsLBL->setText(tr("Index: %1 documents, average length %2 terms."
|
187 |
statsLBL->setText(tr("Index: %1 documents, average length %2 terms."
|
171 |
"%3 results")
|
188 |
"%3 results")
|
172 |
.arg(res.dbdoccount).arg(res.dbavgdoclen, 0, 'f', 1)
|
189 |
.arg(dbs.dbdoccount).arg(dbs.dbavgdoclen, 0, 'f', 1)
|
173 |
.arg(res.entries.size()));
|
190 |
.arg(res.entries.size()));
|
174 |
}
|
191 |
}
|
175 |
|
192 |
|
176 |
break;
|
193 |
break;
|
177 |
|
194 |
|
|
... |
|
... |
237 |
resTW->setItem(row++, 0, new QTableWidgetItem(""));
|
254 |
resTW->setItem(row++, 0, new QTableWidgetItem(""));
|
238 |
}
|
255 |
}
|
239 |
|
256 |
|
240 |
for (vector<Rcl::TermMatchEntry>::iterator it = res.entries.begin();
|
257 |
for (vector<Rcl::TermMatchEntry>::iterator it = res.entries.begin();
|
241 |
it != res.entries.end(); it++) {
|
258 |
it != res.entries.end(); it++) {
|
242 |
LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
|
259 |
LOGDEB2(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
|
243 |
char num[30];
|
260 |
char num[30];
|
244 |
if (it->wcf)
|
261 |
if (it->wcf)
|
245 |
sprintf(num, "%d / %d", it->docs, it->wcf);
|
262 |
sprintf(num, "%d / %d", it->docs, it->wcf);
|
246 |
else
|
263 |
else
|
247 |
num[0] = 0;
|
264 |
num[0] = 0;
|
|
... |
|
... |
257 |
void SpellW::showStats()
|
274 |
void SpellW::showStats()
|
258 |
{
|
275 |
{
|
259 |
statsLBL->setText("");
|
276 |
statsLBL->setText("");
|
260 |
int row = 0;
|
277 |
int row = 0;
|
261 |
|
278 |
|
262 |
Rcl::TermMatchResult res;
|
279 |
Rcl::DbStats res;
|
263 |
if (!rcldb->termMatch(Rcl::Db::ET_WILD, "", "azbogusaz", res, 1)) {
|
280 |
if (!rcldb->dbStats(res)) {
|
264 |
LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
|
281 |
LOGERR(("SpellW::doExpand:rcldb::dbStats failed\n"));
|
265 |
return;
|
282 |
return;
|
266 |
}
|
283 |
}
|
267 |
|
284 |
|
268 |
resTW->setRowCount(row+1);
|
285 |
resTW->setRowCount(row+1);
|
269 |
resTW->setItem(row, 0,
|
286 |
resTW->setItem(row, 0,
|
|
... |
|
... |
364 |
if (idx < 0 || idx > int(m_c2t.size()))
|
381 |
if (idx < 0 || idx > int(m_c2t.size()))
|
365 |
return;
|
382 |
return;
|
366 |
comboboxchoice mode = m_c2t[idx];
|
383 |
comboboxchoice mode = m_c2t[idx];
|
367 |
resTW->setRowCount(0);
|
384 |
resTW->setRowCount(0);
|
368 |
|
385 |
|
369 |
if (mode == TYPECMB_STEM)
|
386 |
if (mode == TYPECMB_STEM) {
|
370 |
stemLangCMB->setEnabled(true);
|
387 |
stemLangCMB->setEnabled(true);
|
|
|
388 |
diacSensCB->setChecked(false);
|
|
|
389 |
diacSensCB->setEnabled(false);
|
|
|
390 |
caseSensCB->setChecked(false);
|
|
|
391 |
caseSensCB->setEnabled(false);
|
371 |
else
|
392 |
} else {
|
372 |
stemLangCMB->setEnabled(false);
|
393 |
stemLangCMB->setEnabled(false);
|
|
|
394 |
diacSensCB->setEnabled(true);
|
|
|
395 |
caseSensCB->setEnabled(true);
|
|
|
396 |
}
|
373 |
if (mode == TYPECMB_STATS)
|
397 |
if (mode == TYPECMB_STATS)
|
374 |
baseWordLE->setEnabled(false);
|
398 |
baseWordLE->setEnabled(false);
|
375 |
else
|
399 |
else
|
376 |
baseWordLE->setEnabled(true);
|
400 |
baseWordLE->setEnabled(true);
|
377 |
|
401 |
|