修改些许bug
This commit is contained in:
parent
c25a519cf8
commit
2a9597991f
|
|
@ -25,10 +25,11 @@ public class TDatasetFiles {
|
|||
* 文件或文件夹名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 类型: file-文件, folder-文件夹
|
||||
*/
|
||||
|
||||
private String type;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue