From e8a3beb70adccba81ec32e6c5164c26f34395265 Mon Sep 17 00:00:00 2001 From: moon <2623532423@qq.com> Date: Thu, 25 Sep 2025 17:06:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E7=B4=A2=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../brichat/service/impl/EsTDatasetFilesServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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