Skip to content

Commit

Permalink
build: 配置文件新增是否开启lucene引擎索引初始化配置
Browse files Browse the repository at this point in the history
  • Loading branch information
chivehao committed Oct 22, 2024
1 parent 9e75727 commit 8800592
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 0.18.1

- 修复Console快速拉取条目后无法定位到对应条目的问题
- 条目封面字段更新后如果是http开头则自动下载到本地
- 修复条目封面字段更新后如果是http开头则自动下载到本地的问题
- 配置文件新增是否开启lucene引擎索引初始化配置

# 0.18.0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package run.ikaros.server.search;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(IndicesProperties.class)
public class IndicesConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,22 @@
public class IndicesInitializer {

private final IndicesService indicesService;
private final IndicesProperties indicesProperties;

public IndicesInitializer(IndicesService indicesService) {
public IndicesInitializer(IndicesService indicesService, IndicesProperties indicesProperties) {
this.indicesService = indicesService;
this.indicesProperties = indicesProperties;
}

/**
* Init indices.
*/
@Async
@EventListener(SchemeInitializedEvent.class)
public void whenSchemeInitialized(SchemeInitializedEvent event) throws InterruptedException {
if (!indicesProperties.getInitializer().isEnabled()) {
return;
}
initSubjectIndices();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package run.ikaros.server.search;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
* Properties for indices.
*
* @see IndicesConfiguration
*/
@Data
@ConfigurationProperties(prefix = "ikaros.indices")
public class IndicesProperties {
private final Initializer initializer = new Initializer();

@Data
public static class Initializer {
private boolean enabled = true;
}
}

0 comments on commit 8800592

Please sign in to comment.