HibernateSearch 中设置动态boost代码例子
HibernateSearch 中设置动态boost代码,例子程序,代买模仿HibernateSearch 官方文档。
?
package www.dazhi360.com;/** * http://www.dazhi360.com/ * @author 大智360企业培训网 */enum UserType { NORMAL, VIP}@Entity@Indexed@DynamicBoost(impl = VIPBoostStrategy.class)public class User { private UserType type; // ....}class VIPBoostStrategy implements BoostStrategy { public float defineBoost(Object value) { User user = ( User ) value; if ( user.getType().equals( UserType.VIP ) ) { return 2.0f; } else { return 1.0f; } }}
?
仅供大家参考....