diff --git a/chat-server/src/main/java/com/bjtds/brichat/service/impl/EsTDatasetFilesServiceImpl.java b/chat-server/src/main/java/com/bjtds/brichat/service/impl/EsTDatasetFilesServiceImpl.java index 1013547..9c91fb2 100644 --- a/chat-server/src/main/java/com/bjtds/brichat/service/impl/EsTDatasetFilesServiceImpl.java +++ b/chat-server/src/main/java/com/bjtds/brichat/service/impl/EsTDatasetFilesServiceImpl.java @@ -68,7 +68,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService { .index(DatasetId) .mappings(m -> m .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("dataset_id", 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 .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(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) .highlight(h -> h