mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
fix: fulltext search,found dictionaries update
This commit is contained in:
parent
e3e0c33614
commit
126e76ee62
|
@ -271,7 +271,7 @@ sptr< Dictionary::DataRequest > ArticleMaker::makeDefinitionFor(
|
|||
|
||||
string header = makeHtmlHeader( phrase.phrase, QString(), true );
|
||||
|
||||
return std::make_shared<ArticleRequest>( phrase, Instances::Group{},
|
||||
return std::make_shared<ArticleRequest>( phrase, Instances::Group{groupId,""},
|
||||
contexts, ftsDicts, header,
|
||||
-1, true );
|
||||
}
|
||||
|
@ -731,6 +731,7 @@ void ArticleRequest::bodyFinished()
|
|||
}
|
||||
}
|
||||
|
||||
ActiveDictIds hittedWord{ group.id, word, dictIds };
|
||||
|
||||
if ( bodyRequests.empty() )
|
||||
{
|
||||
|
@ -775,23 +776,24 @@ void ArticleRequest::bodyFinished()
|
|||
appendDataSlice( footer.data(), footer.size() );
|
||||
}
|
||||
|
||||
|
||||
if ( stemmedWordFinder.get() ) {
|
||||
update();
|
||||
qDebug() << "send dicts(stemmed):" << word << ":" << dictIds;
|
||||
emit GlobalBroadcaster::instance()->dictionaryChanges( ActiveDictIds{ group.id, word, dictIds } );
|
||||
qDebug() << "send dicts(stemmed):" << hittedWord;
|
||||
emit GlobalBroadcaster::instance()->dictionaryChanges( hittedWord );
|
||||
dictIds.clear();
|
||||
}
|
||||
else {
|
||||
finish();
|
||||
qDebug() << "send dicts(finished):" << word << ":" << dictIds;
|
||||
emit GlobalBroadcaster::instance()->dictionaryChanges( ActiveDictIds{ group.id, word, dictIds } );
|
||||
qDebug() << "send dicts(finished):" << hittedWord;
|
||||
emit GlobalBroadcaster::instance()->dictionaryChanges( hittedWord );
|
||||
dictIds.clear();
|
||||
}
|
||||
}
|
||||
else if ( wasUpdated ) {
|
||||
update();
|
||||
qDebug() << "send dicts(updated):" << word << ":" << dictIds;
|
||||
emit GlobalBroadcaster::instance()->dictionaryChanges( ActiveDictIds{ group.id, word, dictIds } );
|
||||
qDebug() << "send dicts(updated):" << hittedWord;
|
||||
emit GlobalBroadcaster::instance()->dictionaryChanges( hittedWord );
|
||||
dictIds.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ sptr< Dictionary::DataRequest > ArticleNetworkAccessManager::getResource(
|
|||
{
|
||||
// Individual dictionaries set from full-text search
|
||||
QStringList dictIDList = dictIDs.split( "," );
|
||||
return articleMaker.makeDefinitionFor( phrase, 0, QMap< QString, QString >(), QSet< QString >(), dictIDList );
|
||||
return articleMaker.makeDefinitionFor( phrase, group, QMap< QString, QString >(), QSet< QString >(), dictIDList );
|
||||
}
|
||||
|
||||
// See if we have some dictionaries muted
|
||||
|
|
|
@ -11,6 +11,11 @@ struct ActiveDictIds
|
|||
unsigned groupId;
|
||||
QString word;
|
||||
QStringList dictIds;
|
||||
|
||||
operator QString() const
|
||||
{
|
||||
return QString( "groupId:%1,word:%2,dictId:%3" ).arg( QString::number( groupId ), word, dictIds.join( "," ) );
|
||||
}
|
||||
};
|
||||
|
||||
class GlobalBroadcaster : public QObject
|
||||
|
|
|
@ -37,8 +37,6 @@ struct Group
|
|||
|
||||
Group(unsigned id, QString const & name_);
|
||||
|
||||
Group() = default;
|
||||
|
||||
/// Makes the configuration group from the current contents.
|
||||
Config::Group makeConfigGroup();
|
||||
|
||||
|
|
Loading…
Reference in a new issue