move stemlang from RclQuery to SearchData. Allow DocSequences to do the sorting/filtering themselves

This commit is contained in:
dockes
2008-09-29 11:33:55 +00:00
parent 828dff3bb1
commit f0538b15f2
16 changed files with 166 additions and 97 deletions
+6 -7
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.53 2008-09-28 14:20:50 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.54 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -99,7 +99,8 @@ void RclMain::init()
static const char* catg_strings[] = {
QT_TR_NOOP("All"), QT_TR_NOOP("media"), QT_TR_NOOP("message"),
QT_TR_NOOP("other"), QT_TR_NOOP("presentation"),
QT_TR_NOOP("spreadsheet"), QT_TR_NOOP("text")
QT_TR_NOOP("spreadsheet"), QT_TR_NOOP("text"),
QT_TR_NOOP("sorted"), QT_TR_NOOP("filtered")
};
curPreview = 0;
@@ -457,19 +458,17 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata)
}
resList->resetList();
int qopts = 0;
if (!prefs.queryStemLang.length() == 0)
qopts |= Rcl::Query::QO_STEM;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
string stemLang = (const char *)prefs.queryStemLang.ascii();
if (stemLang == "ALL") {
rclconfig->getConfParam("indexstemminglanguages", stemLang);
}
sdata->setStemlang(stemLang);
Rcl::Query *query = new Rcl::Query(rcldb);
if (!query || !query->setQuery(sdata, qopts, stemLang)) {
if (!query || !query->setQuery(sdata)) {
QMessageBox::warning(0, "Recoll", tr("Can't start query: ") +
QString::fromAscii(query->getReason().c_str()));
QApplication::restoreOverrideCursor();
+18 -10
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.46 2008-09-29 08:59:20 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.47 2008-09-29 11:33:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include <time.h>
@@ -113,16 +113,24 @@ void ResList::setDocSource()
// Filtering must be done before sorting, (which usually
// truncates the original list)
if (m_filtspecs.isNotNull()) {
m_docSource =
RefCntr<DocSequence>(new DocSeqFiltered(m_docSource,
m_filtspecs, ""));
if (m_baseDocSource->canFilter()) {
m_baseDocSource->setFiltSpec(m_filtspecs);
} else {
if (m_filtspecs.isNotNull()) {
string title = m_baseDocSource->title() + " (" +
string((const char*)tr("filtered").utf8()) + ")";
m_docSource =
RefCntr<DocSequence>(new DocSeqFiltered(m_docSource,m_filtspecs,
title));
}
}
if (m_sortspecs.isNotNull()) {
string title = m_baseDocSource->title() + " (" +
string((const char *)tr("sorted").utf8()) + ")";
m_docSource = RefCntr<DocSequence>(new DocSeqSorted(m_docSource,
m_sortspecs,
string(tr("Query results (sorted)").utf8())));
title));
}
resultPageNext();
}
@@ -162,10 +170,10 @@ void ResList::resetList()
bool ResList::displayingHistory()
{
// We want to reset the displayed history if it is currently shown. Using
// the title value is an ugly hack
return m_docSource->title() ==
string((const char *)tr("Document history").utf8());
// We want to reset the displayed history if it is currently
// shown. Using the title value is an ugly hack
string htstring = string((const char *)tr("Document history").utf8());
return m_docSource->title().find(htstring) == 0;
}
void ResList::languageChange()