码迷,mamicode.com
首页 > Web开发 > 详细

lucene 多字段查询-MultiFieldQueryParser

时间:2016-12-16 16:40:55      阅读:370      评论:0      收藏:0      [点我收藏+]

标签:1.0   bool   sts   string   analyzer   color   parse   author   ash   

 

/**
 * 搜索域加权
 */
Map<String, Float> boosts = new HashMap<>();
boosts.put("title", 1.2f);
boosts.put("author", 1.1f);
boosts.put("content", 1.0f);
/**
 * 多条件之间的关系
 */
BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
BooleanClause.Occur.SHOULD,
BooleanClause.Occur.SHOULD};
Query query=MultiFieldQueryParser.parse(key, new String[]{"title","author","content"},flags, analyzer);

 

lucene 多字段查询-MultiFieldQueryParser

标签:1.0   bool   sts   string   analyzer   color   parse   author   ash   

原文地址:http://www.cnblogs.com/qingyibusi/p/6187402.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!