Package org.compass.core

Examples of org.compass.core.CompassHighlighter


        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) {
View Full Code Here

TOP

Related Classes of org.compass.core.CompassHighlighter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.