“Optimize the parameter in different data source”版本间的差异

来自cslt Wiki
跳转至: 导航搜索
Lr讨论 | 贡献
第1行: 第1行:
 +
=mert=
 +
[detail:http://blog.csdn.net/ict2014/article/details/25307019]
 
=method=
 
=method=
 
==Definition==
 
==Definition==

2014年12月9日 (二) 01:59的版本

mert

[detail:http://blog.csdn.net/ict2014/article/details/25307019]

method

Definition

  • 11.png

problem

boost some specific field in lucene

  • Here is how you can do that[1]
Query titleQuery, viewsQuery;
titleQuery.setBoost(0.8);
viewsQuery.setBoost(0.2);
BooleanQuery query = new BooleanQuery();
query.add(titleQuery, Occur.MUST); // or Occur.SHOULD if this clause is optional
query.add(viewsQuery, Occur.SHOULD); // or Occur.MUST if this clause is required
// use query to search documents

The score will be proportional to 0.8*score(titleQuery) + 0.2*score(viewsQuery) (to a multiplicative constant). To leverage your views field, you will probably need to use a ValueSourceQuery