Skip to content

Commit

Permalink
feat: 开通自然语言索引,增加开启和停用的接口
Browse files Browse the repository at this point in the history
Description: 开通自然语言索引,增加开启和停用的接口

Log: 开通自然语言索引,增加开启和停用的接口
  • Loading branch information
lichaofan2008 authored and Clauszy committed Aug 6, 2024
1 parent 08c06e1 commit 2e847e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void IntelligentRetrievalWidget::updateState()

auto cfg = SearchConfig::instance();
if (isAnalayzeSupported()) {
bool checked = cfg->getConfig(GRANDSEARCH_SEMANTIC_GROUP, GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, true).toBool();
bool checked = cfg->getConfig(GRANDSEARCH_SEMANTIC_GROUP, GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, false).toBool();
m_semantic->checkBox()->setChecked(checked);
m_semantic->checkBox()->setEnabled(true);
} else {
Expand Down Expand Up @@ -226,6 +226,12 @@ void IntelligentRetrievalWidget::checkBoxChanged()
if (sd == m_semantic->checkBox()) {
bool on = m_semantic->checkBox()->isChecked();
cfg->setConfig(GRANDSEARCH_SEMANTIC_GROUP, GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, on);

QDBusMessage msg = createAnalayzeMsg("SetSemanticOn");
QVariantList argvs;
argvs.append(on);
msg.setArguments(argvs);
QDBusConnection::sessionBus().asyncCall(msg, 500);
} else if (sd == m_vector->checkBox()){
bool on = m_vector->checkBox()->isChecked();
cfg->setConfig(GRANDSEARCH_SEMANTIC_GROUP, GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_VECTOR, on);
Expand Down
4 changes: 2 additions & 2 deletions src/libgrand-search-daemon/configuration/configer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ UserPreferencePointer ConfigerPrivate::webSearchEngine()

UserPreferencePointer ConfigerPrivate::semanticEngine()
{
QVariantHash data{{GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, true}
QVariantHash data{{GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, false}
, {GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_VECTOR, true}};

return UserPreferencePointer(new UserPreference(data));
Expand Down Expand Up @@ -204,7 +204,7 @@ bool ConfigerPrivate::updateConfig1(QSettings *set)
set->beginGroup(GRANDSEARCH_SEMANTIC_GROUP);
if (UserPreferencePointer conf = m_root->group(GRANDSEARCH_SEMANTIC_GROUP)) {
bool on = false;
bool ret = set->value(GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, true).toBool();
bool ret = set->value(GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, false).toBool();
conf->setValue(GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, ret);
on |= ret;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bool SemanticSearcher::isActive() const
Q_ASSERT(config);

SemanticParser paser;
if (config->value(GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, true)) {
if (config->value(GRANDSEARCH_CLASS_GENERALFILE_SEMANTIC_ANALYSIS, false)) {
if (paser.connectToAnalyze(SemanticHelper::analyzeServiceName())) {
d->m_semantic = paser.isAnalayzeSupported();
}
Expand Down

0 comments on commit 2e847e6

Please sign in to comment.