Make Recoll optionally sensitive to case and diacritics
--HG-- branch : CASEDIACSENS
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
@@ -756,12 +756,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);
|
||||
|
||||
@@ -1073,9 +1067,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,
|
||||
@@ -1088,7 +1080,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:
|
||||
@@ -1771,7 +1763,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());
|
||||
|
||||
|
||||
|
||||
+8
-12
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user