feat: 完善本地MCP与扩展市场能力

This commit is contained in:
baiyanyun
2026-07-02 17:43:34 +08:00
parent a574b2c661
commit 38adf72939
32 changed files with 3291 additions and 270 deletions

View File

@@ -53,6 +53,12 @@ public class ElasticsearchServiceImpl implements SearchService, ISearchRpcServic
@Value("${search.elasticsearch.password:}")
private String password;
@Value("${search.elasticsearch.text_analyzer:standard}")
private String textAnalyzer;
@Value("${search.elasticsearch.search_analyzer:standard}")
private String searchAnalyzer;
private ElasticsearchClient client;
@PostConstruct
@@ -75,6 +81,14 @@ public class ElasticsearchServiceImpl implements SearchService, ISearchRpcServic
client.shutdown();
}
private String getTextAnalyzer() {
return StringUtils.defaultIfBlank(textAnalyzer, "standard");
}
private String getSearchAnalyzer() {
return StringUtils.defaultIfBlank(searchAnalyzer, getTextAnalyzer());
}
@Override
public void bulkIndex(List<SearchDocument> list) {
Assert.noNullElements(list, "list cannot be left blank.");
@@ -146,8 +160,8 @@ public class ElasticsearchServiceImpl implements SearchService, ISearchRpcServic
if (keyword.get()) {
builder.properties(name.get(), property -> property.keyword(kw -> kw.index(index.get()).store(store.get())));
} else {
builder.properties(name.get(), property -> property.text(text -> text.analyzer("ik_max_word")
.searchAnalyzer("ik_smart").store(store.get()).index(index.get())
builder.properties(name.get(), property -> property.text(text -> text.analyzer(getTextAnalyzer())
.searchAnalyzer(getSearchAnalyzer()).store(store.get()).index(index.get())
));
}
} else if (declaredField.getType() == Integer.class) {
@@ -163,8 +177,8 @@ public class ElasticsearchServiceImpl implements SearchService, ISearchRpcServic
} else if (declaredField.getType() == Date.class) {
builder.properties(name.get(), property -> property.date(date -> date.index(index.get()).store(store.get())));
} else {
builder.properties(name.get(), property -> property.text(text -> text.analyzer("ik_max_word")
.searchAnalyzer("ik_smart").store(store.get()).index(index.get())
builder.properties(name.get(), property -> property.text(text -> text.analyzer(getTextAnalyzer())
.searchAnalyzer(getSearchAnalyzer()).store(store.get()).index(index.get())
));
}
}