mirror of
https://gitee.com/nutz/nutzboot.git
synced 2024-12-02 03:38:08 +08:00
change: nutzboot-demo-simple-elasticsearch HighlightField
This commit is contained in:
parent
bc11db66f3
commit
3894c7f073
@ -138,14 +138,14 @@ public class UserService {
|
||||
Map<String, Object> source = searchHit.getSourceAsMap();
|
||||
Map<String, HighlightField> highlightFields = searchHit.getHighlightFields();
|
||||
//name高亮
|
||||
HighlightField nameField = highlightFields.get("user");
|
||||
HighlightField nameField = highlightFields.get("name");
|
||||
if (nameField != null) {
|
||||
Text[] fragments = nameField.fragments();
|
||||
String tmp = "";
|
||||
for (Text text : fragments) {
|
||||
tmp += text;
|
||||
}
|
||||
source.put("user", tmp);
|
||||
source.put("name", tmp);
|
||||
}
|
||||
list.add(source);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user