我当前使用的是ElasticsearchRepository的方法连接es进行高亮搜索,但是不能实现多字段的高亮搜索,以下是我ElasticsearchRepository接口中的方法。
/**
* 关键字检索(houseInfoName)
*
* @param searchValue 搜索的房源名
* @return
*/
@Highlight(
fields = {
@HighlightField(name = "houseInfoName")
},
parameters = @HighlightParameters(
preTags = "<span style='color:#00ae66;font-weight:bold;'>",
postTags = "</span>",
fragmentSize = 500,
numberOfFragments = 3
)
)
List<SearchHit<EsHouseInfo>> findByHouseInfoName(String searchValue);
我是用的是es版本是7.12.1。