autodiacsens and autocasesens parameters
This commit is contained in:
parent
c589419267
commit
2807fa3c18
@ -115,6 +115,14 @@ void ConfIndexW::reloadPanels()
|
|||||||
w = new ConfBeaglePanelW(this, m_conf);
|
w = new ConfBeaglePanelW(this, m_conf);
|
||||||
m_widgets.push_back(w);
|
m_widgets.push_back(w);
|
||||||
tabWidget->addTab(w, QObject::tr("Beagle web history"));
|
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)
|
ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
||||||
@ -155,6 +163,41 @@ ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
|||||||
vboxLayout->insertStretch(-1);
|
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("<p>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 <i>D</i> "
|
||||||
|
"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("<p>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 <i>C</i> modifier to specify character-case "
|
||||||
|
"sensitivity."
|
||||||
|
));
|
||||||
|
vboxLayout->addWidget(cp2);
|
||||||
|
|
||||||
|
vboxLayout->insertStretch(-1);
|
||||||
|
}
|
||||||
|
|
||||||
ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
@ -264,9 +307,23 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
|||||||
ConfParamFNW(this, lnkdbd, tr("Database directory name"),
|
ConfParamFNW(this, lnkdbd, tr("Database directory name"),
|
||||||
tr("The name for a directory where to store the index<br>"
|
tr("The name for a directory where to store the index<br>"
|
||||||
"A non-absolute path is taken relative to the "
|
"A non-absolute path is taken relative to the "
|
||||||
" configuration directory. The default is 'xapiandb'."
|
"configuration directory. The default is 'xapiandb'."
|
||||||
), true);
|
), true);
|
||||||
gl1->addWidget(edbd, 7, 0, 1, 2);
|
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("<p>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)
|
ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||||
|
|||||||
@ -90,15 +90,18 @@ private:
|
|||||||
void reloadAll();
|
void reloadAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Extra or little used parameters
|
|
||||||
*/
|
|
||||||
class ConfBeaglePanelW : public QWidget {
|
class ConfBeaglePanelW : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ConfBeaglePanelW(QWidget *parent, ConfNull *config);
|
ConfBeaglePanelW(QWidget *parent, ConfNull *config);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ConfSearchPanelW : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ConfSearchPanelW(QWidget *parent, ConfNull *config);
|
||||||
|
};
|
||||||
|
|
||||||
} // Namespace confgui
|
} // Namespace confgui
|
||||||
|
|
||||||
#endif /* _confguiindex_h_included_ */
|
#endif /* _confguiindex_h_included_ */
|
||||||
|
|||||||
@ -379,7 +379,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="indexConfigAction">
|
<action name="indexConfigAction">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Indexing configuration</string>
|
<string>&Index configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="name" stdset="0">
|
<property name="name" stdset="0">
|
||||||
<cstring>indexConfigAction</cstring>
|
<cstring>indexConfigAction</cstring>
|
||||||
@ -395,7 +395,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="queryPrefsAction">
|
<action name="queryPrefsAction">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Query configuration</string>
|
<string>&GUI configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="name" stdset="0">
|
<property name="name" stdset="0">
|
||||||
<cstring>queryPrefsAction</cstring>
|
<cstring>queryPrefsAction</cstring>
|
||||||
|
|||||||
@ -622,8 +622,12 @@ public:
|
|||||||
StringToXapianQ(Db& db, HighlightData& hld, const string& field,
|
StringToXapianQ(Db& db, HighlightData& hld, const string& field,
|
||||||
const string &stmlng, bool boostUser)
|
const string &stmlng, bool boostUser)
|
||||||
: m_db(db), m_field(field), m_stemlang(stmlng),
|
: 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,
|
bool processUserString(const string &iq,
|
||||||
int mods,
|
int mods,
|
||||||
@ -649,6 +653,8 @@ private:
|
|||||||
const string& m_stemlang;
|
const string& m_stemlang;
|
||||||
const bool m_doBoostUserTerms;
|
const bool m_doBoostUserTerms;
|
||||||
HighlightData& m_hld;
|
HighlightData& m_hld;
|
||||||
|
bool m_autodiacsens;
|
||||||
|
bool m_autocasesens;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
@ -715,7 +721,7 @@ void StringToXapianQ::expandTerm(int mods,
|
|||||||
// diacritic-sensitive. Note that the way that the test is
|
// diacritic-sensitive. Note that the way that the test is
|
||||||
// performed (conversion+comparison) will automatically ignore
|
// performed (conversion+comparison) will automatically ignore
|
||||||
// accented characters which are actually a separate letter
|
// accented characters which are actually a separate letter
|
||||||
if (unachasaccents(term)) {
|
if (m_autodiacsens && unachasaccents(term)) {
|
||||||
LOGDEB0(("expandTerm: term has accents -> diac-sensitive\n"));
|
LOGDEB0(("expandTerm: term has accents -> diac-sensitive\n"));
|
||||||
diac_sensitive = true;
|
diac_sensitive = true;
|
||||||
}
|
}
|
||||||
@ -726,7 +732,7 @@ void StringToXapianQ::expandTerm(int mods,
|
|||||||
// modifier to search for Floor in a case-sensitive way.
|
// modifier to search for Floor in a case-sensitive way.
|
||||||
Utf8Iter it(term);
|
Utf8Iter it(term);
|
||||||
it++;
|
it++;
|
||||||
if (unachasuppercase(term.substr(it.getBpos()))) {
|
if (m_autocasesens && unachasuppercase(term.substr(it.getBpos()))) {
|
||||||
LOGDEB0(("expandTerm: term has uppercase -> case-sensitive\n"));
|
LOGDEB0(("expandTerm: term has uppercase -> case-sensitive\n"));
|
||||||
case_sensitive = true;
|
case_sensitive = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,6 +57,19 @@ logfilename = stderr
|
|||||||
# default to a stripped index for now.
|
# default to a stripped index for now.
|
||||||
indexStripChars = 1
|
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
|
# Languages for which to build stemming databases at the end of
|
||||||
# indexing. Stemmer names can be found on http://www.xapian.org
|
# 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
|
# The flag to perform stem expansion at query time is now set from the GUI
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user