diff --git a/src/qtgui/confgui/confguiindex.cpp b/src/qtgui/confgui/confguiindex.cpp index 05158310..50e9891c 100644 --- a/src/qtgui/confgui/confguiindex.cpp +++ b/src/qtgui/confgui/confguiindex.cpp @@ -115,6 +115,14 @@ void ConfIndexW::reloadPanels() w = new ConfBeaglePanelW(this, m_conf); m_widgets.push_back(w); tabWidget->addTab(w, QObject::tr("Beagle web history")); + +#ifndef RCL_INDEX_STRIPCHARS + if (!o_index_stripchars) { + w = new ConfSearchPanelW(this, m_conf); + m_widgets.push_back(w); + tabWidget->addTab(w, QObject::tr("Search parameters")); + } +#endif } ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config) @@ -155,6 +163,41 @@ ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config) vboxLayout->insertStretch(-1); } +ConfSearchPanelW::ConfSearchPanelW(QWidget *parent, ConfNull *config) + : QWidget(parent) +{ + QVBoxLayout *vboxLayout = new QVBoxLayout(this); + vboxLayout->setSpacing(spacing); + vboxLayout->setMargin(margin); + + ConfLink lnk1(new ConfLinkRclRep(config, "autodiacsens")); + ConfParamBoolW* cp1 = + new ConfParamBoolW(this, lnk1, tr("Automatic diacritics sensitivity"), + tr("

Automatically trigger diacritics sensitivity " + "if the search term has accented characters " + "(not in unac_except_trans). Else you need to " + "use the query language and the D " + "modifier to specify " + "diacritics sensitivity." + )); + vboxLayout->addWidget(cp1); + + ConfLink lnk2(new ConfLinkRclRep(config, "autocasesens")); + ConfParamBoolW* cp2 = + new ConfParamBoolW(this, lnk2, + tr("Automatic character case sensitivity"), + tr("

Automatically trigger character case " + "sensitivity if the entry has upper-case " + "characters in any but the first position. " + "Else you need to use the query language and " + "the C modifier to specify character-case " + "sensitivity." + )); + vboxLayout->addWidget(cp2); + + vboxLayout->insertStretch(-1); +} + ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config) : QWidget(parent) { @@ -264,9 +307,23 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config) ConfParamFNW(this, lnkdbd, tr("Database directory name"), tr("The name for a directory where to store the index
" "A non-absolute path is taken relative to the " - " configuration directory. The default is 'xapiandb'." + "configuration directory. The default is 'xapiandb'." ), true); gl1->addWidget(edbd, 7, 0, 1, 2); + + ConfLink lnkuexc(new ConfLinkRclRep(config, "unac_except_trans")); + ConfParamStrW *euexc = new + ConfParamStrW(this, lnkuexc, tr("Unac exceptions"), + tr("

These are exceptions to the unac mechanism " + "which, by default, removes all diacritics, " + "and performs canonic decomposition. You can override " + "unaccenting for some characters, depending on your " + "language, and specify additional decompositions, " + "e.g. for ligatures. In each space-separated entry, " + "the first character is the source one, and the rest " + "is the translation." + )); + gl1->addWidget(euexc, 8, 0, 1, 2); } ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config) diff --git a/src/qtgui/confgui/confguiindex.h b/src/qtgui/confgui/confguiindex.h index a992cd64..f6d25fc2 100644 --- a/src/qtgui/confgui/confguiindex.h +++ b/src/qtgui/confgui/confguiindex.h @@ -90,15 +90,18 @@ private: void reloadAll(); }; -/** - * Extra or little used parameters - */ class ConfBeaglePanelW : public QWidget { Q_OBJECT public: ConfBeaglePanelW(QWidget *parent, ConfNull *config); }; +class ConfSearchPanelW : public QWidget { + Q_OBJECT +public: + ConfSearchPanelW(QWidget *parent, ConfNull *config); +}; + } // Namespace confgui #endif /* _confguiindex_h_included_ */ diff --git a/src/qtgui/rclmain.ui b/src/qtgui/rclmain.ui index f04f86cb..1f4c1874 100644 --- a/src/qtgui/rclmain.ui +++ b/src/qtgui/rclmain.ui @@ -379,7 +379,7 @@ - &Indexing configuration + &Index configuration indexConfigAction @@ -395,7 +395,7 @@ - &Query configuration + &GUI configuration queryPrefsAction diff --git a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp index 08e84738..675b535a 100644 --- a/src/rcldb/searchdata.cpp +++ b/src/rcldb/searchdata.cpp @@ -622,8 +622,12 @@ public: StringToXapianQ(Db& db, HighlightData& hld, const string& field, const string &stmlng, bool boostUser) : m_db(db), m_field(field), m_stemlang(stmlng), - m_doBoostUserTerms(boostUser), m_hld(hld) - { } + m_doBoostUserTerms(boostUser), m_hld(hld), m_autodiacsens(false), + m_autocasesens(true) + { + m_db.getConf()->getConfParam("autodiacsens", &m_autodiacsens); + m_db.getConf()->getConfParam("autocasesens", &m_autocasesens); + } bool processUserString(const string &iq, int mods, @@ -649,6 +653,8 @@ private: const string& m_stemlang; const bool m_doBoostUserTerms; HighlightData& m_hld; + bool m_autodiacsens; + bool m_autocasesens; }; #if 1 @@ -715,7 +721,7 @@ void StringToXapianQ::expandTerm(int mods, // diacritic-sensitive. Note that the way that the test is // performed (conversion+comparison) will automatically ignore // accented characters which are actually a separate letter - if (unachasaccents(term)) { + if (m_autodiacsens && unachasaccents(term)) { LOGDEB0(("expandTerm: term has accents -> diac-sensitive\n")); diac_sensitive = true; } @@ -726,7 +732,7 @@ void StringToXapianQ::expandTerm(int mods, // modifier to search for Floor in a case-sensitive way. Utf8Iter it(term); it++; - if (unachasuppercase(term.substr(it.getBpos()))) { + if (m_autocasesens && unachasuppercase(term.substr(it.getBpos()))) { LOGDEB0(("expandTerm: term has uppercase -> case-sensitive\n")); case_sensitive = true; } diff --git a/src/sampleconf/recoll.conf.in b/src/sampleconf/recoll.conf.in index a5feddf1..f6af2b3b 100644 --- a/src/sampleconf/recoll.conf.in +++ b/src/sampleconf/recoll.conf.in @@ -57,6 +57,19 @@ logfilename = stderr # default to a stripped index for now. indexStripChars = 1 +# IF the index is not stripped. Decide if we automatically trigger +# diacritics sensitivity if the search term has accented characters (not in +# unac_except_trans). Else you need to use the query language and the "D" +# modifier to specify diacritics sensitivity. Default is no. +autodiacsens = 0 + +# IF the index is not stripped. Decide if we automatically trigger +# character case sensitivity if the search term has upper-case characters +# in any but the first position. Else you need to use the query language +# and the "C" modifier to specify character-case sensitivity. Default is +# yes. +autocasesens = 1 + # Languages for which to build stemming databases at the end of # indexing. Stemmer names can be found on http://www.xapian.org # The flag to perform stem expansion at query time is now set from the GUI