修改些许bug

This commit is contained in:
moon 2025-09-16 16:32:05 +08:00
parent c25a519cf8
commit 2a9597991f
2 changed files with 5 additions and 3 deletions

View File

@ -29,6 +29,7 @@ public class TDatasetFiles {
/**
* 类型: file-文件, folder-文件夹
*/
private String type;
/**

View File

@ -5,7 +5,7 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch.core.SearchResponse;
import co.elastic.clients.elasticsearch.core.search.Hit;
import com.bjtds.brichat.entity.dataset.TDatasetFiles;
import co.elastic.clients.elasticsearch._types.mapping.DynamicMapping;
import com.bjtds.brichat.entity.dto.RecordDto;
import com.bjtds.brichat.entity.dto.RetrievalDto;
import com.bjtds.brichat.entity.esmodel.IndexInfo;
@ -54,6 +54,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService {
client.indices().create(c -> c
.index(DatasetId)
.mappings(m -> m
.dynamic(DynamicMapping.False)
.properties("name", 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))
@ -223,7 +224,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService {
SearchResponse<TDatasetFiles> response = client.search(s -> s
.index(DatasetId)
.query(q -> q.bool(b -> b
.should(s1 -> s1.match(m -> m.field("title").query(keyword)))
.should(s1 -> s1.match(m -> m.field("name").query(keyword)))
.should(s2 -> s2.match(m -> m.field("content").query(keyword)))
))
.size(500)