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,9 +263,14 @@ public:
|
|||
|
||||
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() ) {
|
||||
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:
|
||||
|
||||
|
|
|
@ -219,7 +219,11 @@ public:
|
|||
|
||||
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() ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,11 @@ public:
|
|||
|
||||
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() ) {
|
||||
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;
|
||||
bool synonymSearchEnabled;
|
||||
string dictionaryName;
|
||||
//default to true;
|
||||
bool enable_FTS = true;
|
||||
std::optional< bool > metadata_enable_fts = std::nullopt;
|
||||
|
||||
// Load user icon if it exist
|
||||
// By default set icon to empty
|
||||
|
@ -376,7 +375,7 @@ public:
|
|||
|
||||
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,
|
||||
|
|
|
@ -235,8 +235,11 @@ public:
|
|||
{
|
||||
if ( ensureInitDone().size() )
|
||||
return;
|
||||
|
||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "DSL", Qt::CaseInsensitive )
|
||||
if ( metadata_enable_fts.has_value() ) {
|
||||
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||
}
|
||||
else
|
||||
can_FTS = fts.enabled && !fts.disabledTypes.contains( "DSL", Qt::CaseInsensitive )
|
||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||
}
|
||||
|
||||
|
|
|
@ -154,8 +154,11 @@ public:
|
|||
{
|
||||
if ( ensureInitDone().size() )
|
||||
return;
|
||||
|
||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive )
|
||||
if ( metadata_enable_fts.has_value() ) {
|
||||
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||
}
|
||||
else
|
||||
can_FTS = fts.enabled && !fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive )
|
||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||
}
|
||||
|
||||
|
|
|
@ -408,7 +408,11 @@ public:
|
|||
|
||||
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() ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -260,8 +260,11 @@ public:
|
|||
{
|
||||
if ( !ensureInitDone().empty() )
|
||||
return;
|
||||
|
||||
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive )
|
||||
if ( metadata_enable_fts.has_value() ) {
|
||||
can_FTS = fts.enabled && metadata_enable_fts.value();
|
||||
}
|
||||
else
|
||||
can_FTS = fts.enabled && !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive )
|
||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,11 @@ public:
|
|||
|
||||
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() ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -640,7 +640,11 @@ public:
|
|||
|
||||
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() ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,11 @@ public:
|
|||
|
||||
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() ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,11 @@ public:
|
|||
|
||||
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() ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,11 @@ public:
|
|||
|
||||
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() ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue