mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
fix: prioritize the manual set full text index option per dictionary (#1730)
* fix: prioritize the manual set full text index option per dictionary
This commit is contained in:
parent
555811e3f3
commit
9332763f67
|
@ -263,8 +263,13 @@ public:
|
||||||
|
|
||||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||||
{
|
{
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "AARD", Qt::CaseInsensitive )
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "AARD", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -219,8 +219,12 @@ public:
|
||||||
|
|
||||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||||
{
|
{
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "BGL", Qt::CaseInsensitive )
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "BGL", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -140,8 +140,12 @@ public:
|
||||||
|
|
||||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||||
{
|
{
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "DICTD", Qt::CaseInsensitive )
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "DICTD", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -315,8 +315,7 @@ protected:
|
||||||
QAtomicInt FTS_index_completed;
|
QAtomicInt FTS_index_completed;
|
||||||
bool synonymSearchEnabled;
|
bool synonymSearchEnabled;
|
||||||
string dictionaryName;
|
string dictionaryName;
|
||||||
//default to true;
|
std::optional< bool > metadata_enable_fts = std::nullopt;
|
||||||
bool enable_FTS = true;
|
|
||||||
|
|
||||||
// Load user icon if it exist
|
// Load user icon if it exist
|
||||||
// By default set icon to empty
|
// By default set icon to empty
|
||||||
|
@ -376,7 +375,7 @@ public:
|
||||||
|
|
||||||
void setFtsEnable( bool _enable_FTS )
|
void setFtsEnable( bool _enable_FTS )
|
||||||
{
|
{
|
||||||
enable_FTS = _enable_FTS;
|
metadata_enable_fts = _enable_FTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns all the available properties, like the author's name, copyright,
|
/// Returns all the available properties, like the author's name, copyright,
|
||||||
|
|
|
@ -235,9 +235,12 @@ public:
|
||||||
{
|
{
|
||||||
if ( ensureInitDone().size() )
|
if ( ensureInitDone().size() )
|
||||||
return;
|
return;
|
||||||
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "DSL", Qt::CaseInsensitive )
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "DSL", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getFtsIndexVersion() override
|
uint32_t getFtsIndexVersion() override
|
||||||
|
|
|
@ -154,9 +154,12 @@ public:
|
||||||
{
|
{
|
||||||
if ( ensureInitDone().size() )
|
if ( ensureInitDone().size() )
|
||||||
return;
|
return;
|
||||||
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive )
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int japaneseWriting( gd::wchar ch );
|
static int japaneseWriting( gd::wchar ch );
|
||||||
|
|
|
@ -408,8 +408,12 @@ public:
|
||||||
|
|
||||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||||
{
|
{
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "GLS", Qt::CaseInsensitive )
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "GLS", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -260,9 +260,12 @@ public:
|
||||||
{
|
{
|
||||||
if ( !ensureInitDone().empty() )
|
if ( !ensureInitDone().empty() )
|
||||||
return;
|
return;
|
||||||
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive )
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getCachedFileName( QString name );
|
QString getCachedFileName( QString name );
|
||||||
|
|
|
@ -177,8 +177,12 @@ public:
|
||||||
|
|
||||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||||
{
|
{
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "SDICT", Qt::CaseInsensitive )
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "SDICT", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -640,8 +640,12 @@ public:
|
||||||
|
|
||||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||||
{
|
{
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "SLOB", Qt::CaseInsensitive )
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "SLOB", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getFtsIndexVersion() override
|
uint32_t getFtsIndexVersion() override
|
||||||
|
|
|
@ -200,8 +200,12 @@ public:
|
||||||
|
|
||||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||||
{
|
{
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "STARDICT", Qt::CaseInsensitive )
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "STARDICT", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -200,8 +200,12 @@ public:
|
||||||
|
|
||||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||||
{
|
{
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "XDXF", Qt::CaseInsensitive )
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "XDXF", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getFtsIndexVersion() override
|
uint32_t getFtsIndexVersion() override
|
||||||
|
|
|
@ -221,8 +221,12 @@ public:
|
||||||
|
|
||||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||||
{
|
{
|
||||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "ZIM", Qt::CaseInsensitive )
|
if ( metadata_enable_fts.has_value() ) {
|
||||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
can_FTS = fts.enabled && !fts.disabledTypes.contains( "ZIM", Qt::CaseInsensitive )
|
||||||
|
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue