修改检索方式
This commit is contained in:
parent
8a357008a3
commit
e8a3beb70a
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue