“Optimize the parameter in different data source”版本间的差异
来自cslt Wiki
(→boost some specific field in lucene) |
(→Definition) |
||
第2行: | 第2行: | ||
==Definition== | ==Definition== | ||
* formula | * formula | ||
− | + | score(q_1,query)=w_1×f_1 (q_1,query,STD)+w_(2×) f_1 (q_1,query,STD+ANS)+w_3×f_1 (q_1,query,STD+EXT) | |
− | + | ||
==boost some specific field in lucene== | ==boost some specific field in lucene== | ||
* Here is how you can do that[http://stackoverflow.com/questions/9829161/lucene-how-to-boost-some-specific-field] | * Here is how you can do that[http://stackoverflow.com/questions/9829161/lucene-how-to-boost-some-specific-field] |
2014年11月21日 (五) 02:28的版本
method
Definition
- formula
score(q_1,query)=w_1×f_1 (q_1,query,STD)+w_(2×) f_1 (q_1,query,STD+ANS)+w_3×f_1 (q_1,query,STD+EXT)
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