T model = (T) hits.data(i);
//在对模型进行高亮之前先从数据库加载模型
model = getEntityManager().find(modelClass, model.getId());
//防止高亮设置更新进入文档数据
getEntityManager().detach(model);
CompassHighlighter highlighter = hits.highlighter(i);
//高亮处理
for (String searchProperty : model.getSearchProperties()) {
try {
String value = highlighter.fragment(searchProperty);
if (StringUtils.isNotBlank(value)) {
try {
ReflectionUtils.setFieldValue(model, searchProperty, value);
LOG.debug("给对象【" + model.getMetaData() +" : "+model.getId()+ "】的【" + searchProperty + "】属性添加高亮成功");
} catch (Exception e) {