Merge branch 'es'

This commit is contained in:
wenjinbo 2025-09-25 17:09:38 +08:00
commit 6d6f7c610d
1 changed files with 4 additions and 1 deletions

View File

@ -68,7 +68,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService {
.index(DatasetId) .index(DatasetId)
.mappings(m -> m .mappings(m -> m
.dynamic(DynamicMapping.False) .dynamic(DynamicMapping.False)
.properties("name", p -> p.text(t -> t.analyzer("ik_max_word").searchAnalyzer("ik_max_word"))) .properties("name", p -> p.text(t -> t.analyzer("ik_max_word").fields("keyword", f -> f.keyword(k -> k))))
.properties("content", p -> p.text(t -> t.analyzer("ik_max_word").searchAnalyzer("ik_max_word"))) .properties("content", p -> p.text(t -> t.analyzer("ik_max_word").searchAnalyzer("ik_max_word")))
.properties("dataset_id", p -> p.keyword(k -> k)) .properties("dataset_id", p -> p.keyword(k -> k))
.properties("source_url", p -> p.keyword(k -> k)) .properties("source_url", p -> p.keyword(k -> k))
@ -281,6 +281,9 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService {
.query(q -> q.bool(b -> b .query(q -> q.bool(b -> b
.should(s1 -> s1.match(m -> m.field("name").query(keyword).analyzer("ik_smart"))) .should(s1 -> s1.match(m -> m.field("name").query(keyword).analyzer("ik_smart")))
.should(s2 -> s2.match(m -> m.field("content").query(keyword).analyzer("ik_smart"))) .should(s2 -> s2.match(m -> m.field("content").query(keyword).analyzer("ik_smart")))
.should(s3 -> s3.match(m -> m.field("name").query(keyword).analyzer("ik_max_word")))
.should(s4 -> s4.match(m -> m.field("content").query(keyword).analyzer("ik_max_word")))
.should(s5 -> s5.term(t -> t.field("name.keyword").value(keyword)))
)) ))
.size(500) .size(500)
.highlight(h -> h .highlight(h -> h