“Optimize the parameter in different data source”版本间的差异
来自cslt Wiki
(以“=method= ==Definition== * formula :* data source: q:standard question, q-a:standard question and answer, q-e: standard question and extracted question, q-w:standard...”为内容创建页面) |
(→Definition) |
||
| 第4行: | 第4行: | ||
:* data source: q:standard question, q-a:standard question and answer, q-e: standard question and extracted question, q-w:standard question with weight. | :* data source: q:standard question, q-a:standard question and answer, q-e: standard question and extracted question, q-w:standard question with weight. | ||
:* lucent result: q: q1 ,q2 ,q3 ,q4,q5, q-a:k1,k2,k3,k4,k5, q-e:m1,m2,m3,m4,m5 | :* lucent result: q: q1 ,q2 ,q3 ,q4,q5, q-a:k1,k2,k3,k4,k5, q-e:m1,m2,m3,m4,m5 | ||
| + | ==boost some specific field== | ||
| + | * Here is how you can do that[http://stackoverflow.com/questions/9829161/lucene-how-to-boost-some-specific-field] | ||
| + | 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 | ||
2014年11月21日 (五) 01:51的版本
method
Definition
- formula
- data source: q:standard question, q-a:standard question and answer, q-e: standard question and extracted question, q-w:standard question with weight.
- lucent result: q: q1 ,q2 ,q3 ,q4,q5, q-a:k1,k2,k3,k4,k5, q-e:m1,m2,m3,m4,m5
boost some specific field
- 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