mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-11 17:41:04 +08:00
64 lines
1.5 KiB
Java
64 lines
1.5 KiB
Java
package com.openisle.search;
|
|
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
@Getter
|
|
@Setter
|
|
@ConfigurationProperties(prefix = "app.search")
|
|
public class OpenSearchProperties {
|
|
|
|
private boolean enabled = false;
|
|
private String host = "localhost";
|
|
private int port = 9200;
|
|
private String scheme = "http";
|
|
private String username;
|
|
private String password;
|
|
private String indexPrefix = "openisle";
|
|
private boolean initialize = true;
|
|
private int highlightFragmentSize = 200;
|
|
private boolean reindexOnStartup = false;
|
|
private int reindexBatchSize = 500;
|
|
|
|
private Indices indices = new Indices();
|
|
|
|
public String postsIndex() {
|
|
return indexName(indices.posts);
|
|
}
|
|
|
|
public String commentsIndex() {
|
|
return indexName(indices.comments);
|
|
}
|
|
|
|
public String usersIndex() {
|
|
return indexName(indices.users);
|
|
}
|
|
|
|
public String categoriesIndex() {
|
|
return indexName(indices.categories);
|
|
}
|
|
|
|
public String tagsIndex() {
|
|
return indexName(indices.tags);
|
|
}
|
|
|
|
private String indexName(String suffix) {
|
|
if (indexPrefix == null || indexPrefix.isBlank()) {
|
|
return suffix;
|
|
}
|
|
return indexPrefix + "-" + suffix;
|
|
}
|
|
|
|
@Getter
|
|
@Setter
|
|
public static class Indices {
|
|
|
|
private String posts = "posts";
|
|
private String comments = "comments";
|
|
private String users = "users";
|
|
private String categories = "categories";
|
|
private String tags = "tags";
|
|
}
|
|
}
|