merged the case/diac sensitivity code back into trunk

This commit is contained in:
"Jean-Francois Dockes ext:(%22)
2012-09-25 19:20:24 +02:00
40 changed files with 1155 additions and 595 deletions
+2 -1
View File
@@ -356,8 +356,9 @@ size_t AdvSearch::stringToSize(QString qsize)
using namespace Rcl;
void AdvSearch::runSearch()
{
string stemLang = prefs.stemlang();
RefCntr<SearchData> sdata(new SearchData(conjunctCMB->currentIndex() == 0 ?
SCLT_AND : SCLT_OR));
SCLT_AND : SCLT_OR, stemLang));
bool hasclause = false;
for (list<SearchClauseW*>::iterator it = m_clauseWins.begin();
+12
View File
@@ -372,6 +372,18 @@ void rwSettings(bool writing)
}
}
string PrefsPack::stemlang()
{
string stemLang = (const char *)prefs.queryStemLang.toAscii();
if (stemLang == "ALL") {
if (theconfig)
theconfig->getConfParam("indexstemminglanguages", stemLang);
else
stemLang = "";
}
return stemLang;
}
QString myGetFileName(bool isdir, QString caption, bool filenosave)
{
LOGDEB1(("myFileDialog: isdir %d\n", isdir));
+2
View File
@@ -120,6 +120,8 @@ class PrefsPack {
// Default paragraph format for result list
static const char *dfltResListFormat;
std::string stemlang();
PrefsPack() :
respagesize(8),
reslistfontsize(10),
+3 -11
View File
@@ -757,12 +757,6 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata)
return;
}
string stemLang = (const char *)prefs.queryStemLang.toAscii();
if (stemLang == "ALL") {
theconfig->getConfParam("indexstemminglanguages", stemLang);
}
sdata->setStemlang(stemLang);
Rcl::Query *query = new Rcl::Query(rcldb);
query->setCollapseDuplicates(prefs.collapseDuplicates);
@@ -1078,9 +1072,7 @@ void RclMain::showActiveTypes()
// Get list of all mime types in index. For this, we use a
// wildcard field search on mtype
Rcl::TermMatchResult matches;
string prefix;
if (!rcldb->termMatch(Rcl::Db::ET_WILD, "", "*", matches, -1, "mtype",
&prefix)) {
if (!rcldb->termMatch(Rcl::Db::ET_WILD, "", "*", matches, -1, "mtype")) {
QMessageBox::warning(0, tr("Error"),
tr("Index query error"),
QMessageBox::Ok,
@@ -1093,7 +1085,7 @@ void RclMain::showActiveTypes()
for (vector<Rcl::TermMatchEntry>::const_iterator it =
matches.entries.begin();
it != matches.entries.end(); it++) {
mtypesfromdb.insert(it->term.substr(prefix.size()));
mtypesfromdb.insert(it->term.substr(matches.prefix.size()));
}
// All types listed in mimeconf:
@@ -1779,7 +1771,7 @@ void RclMain::showDocHistory()
}
// Construct a bogus SearchData structure
RefCntr<Rcl::SearchData>searchdata =
RefCntr<Rcl::SearchData>(new Rcl::SearchData(Rcl::SCLT_AND));
RefCntr<Rcl::SearchData>(new Rcl::SearchData(Rcl::SCLT_AND, cstr_null));
searchdata->setDescription((const char *)tr("History data").toUtf8());
+14 -4
View File
@@ -198,10 +198,19 @@ void QtGuiResListPager::suggest(const vector<string>uterms,
// If the term is in the index, we don't suggest alternatives.
// Actually, we may want to check the frequencies and propose something
// anyway if a possible variation is much more common (as google does)
if (aspell->check(*rcldb, *uit, reason))
continue;
else if (!reason.empty())
return;
#warning need to take case and diacs sensibility into account somehow
// Maybe use the xapian index instead ? How to retrieve the
// sensitivity flags ?
// We used to call aspell->check() here and continue if it
// succeeded. but this does not work if we are in
// case-sensitive mode and the term was not found because of a
// case difference (our aspell is all lowercase).
// if (aspell->check(*uit, reason))
// continue;
// else if (!reason.empty())
// return;
if (!aspell->suggest(*rcldb, *uit, asuggs, reason)) {
LOGERR(("QtGuiResListPager::suggest: aspell failed: %s\n",
reason.c_str()));
@@ -337,6 +346,7 @@ ResList::~ResList()
QT_TR_NOOP("Open"),
QT_TR_NOOP("(show query)"),
QT_TR_NOOP("<p><i>Alternate spellings (accents suppressed): </i>"),
QT_TR_NOOP("<p><i>Alternate spellings: </i>"),
};
}
+8 -12
View File
@@ -126,23 +126,25 @@ void SSearch::startSimpleSearch()
if (u8.length() == 0)
return;
string stemlang = prefs.stemlang();
SSearchType tp = (SSearchType)searchTypCMB->currentIndex();
Rcl::SearchData *sdata = 0;
if (tp == SST_LANG) {
string reason;
if (prefs.autoSuffsEnable)
sdata = wasaStringToRcl(theconfig, u8, reason,
sdata = wasaStringToRcl(theconfig, stemlang, u8, reason,
(const char *)prefs.autoSuffs.toUtf8());
else
sdata = wasaStringToRcl(theconfig, u8, reason);
sdata = wasaStringToRcl(theconfig, stemlang, u8, reason);
if (sdata == 0) {
QMessageBox::warning(0, "Recoll", tr("Bad query string") + ": " +
QString::fromAscii(reason.c_str()));
return;
}
} else {
sdata = new Rcl::SearchData(Rcl::SCLT_OR);
sdata = new Rcl::SearchData(Rcl::SCLT_OR, stemlang);
if (sdata == 0) {
QMessageBox::warning(0, "Recoll", tr("Out of memory"));
return;
@@ -166,11 +168,6 @@ void SSearch::startSimpleSearch()
}
if (prefs.ssearchAutoPhrase && rcldb) {
string stemLang = (const char *)prefs.queryStemLang.toAscii();
if (stemLang == "ALL") {
theconfig->getConfParam("indexstemminglanguages", stemLang);
}
sdata->setStemlang(stemLang);
sdata->maybeAddAutoPhrase(*rcldb,
prefs.ssearchAutoPhraseThreshPC / 100.0);
}
@@ -277,10 +274,9 @@ void SSearch::completion()
// Query database
const int max = 100;
Rcl::TermMatchResult tmres;
string stemLang = (const char *)prefs.queryStemLang.toAscii();
if (stemLang == "ALL") {
theconfig->getConfParam("indexstemminglanguages", stemLang);
}
string stemLang = prefs.stemlang();
if (!rcldb->termMatch(Rcl::Db::ET_WILD, stemLang, s, tmres, max) ||
tmres.entries.size() == 0) {
QApplication::beep();