本文整理汇总了Java中org.apache.lucene.search.payloads.PayloadTermQuery.setBoost方法的典型用法代码示例。如果您正苦于以下问题:Java PayloadTermQuery.setBoost方法的具体用法?Java PayloadTermQuery.setBoost怎么用?Java PayloadTermQuery.setBoost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.search.payloads.PayloadTermQuery
的用法示例。
在下文中一共展示了PayloadTermQuery.setBoost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSpanQuery
import org.apache.lucene.search.payloads.PayloadTermQuery; //导入方法依赖的package包/类
@Override
public SpanQuery getSpanQuery(Element e) throws ParserException {
String fieldName = DOMUtils.getAttributeWithInheritanceOrFail(e, "fieldName");
String value = DOMUtils.getNonBlankTextOrFail(e);
PayloadTermQuery btq = new PayloadTermQuery(new Term(fieldName, value), new AveragePayloadFunction());
btq.setBoost(DOMUtils.getAttribute(e, "boost", 1.0f));
return btq;
}
示例2: getMathQueries
import org.apache.lucene.search.payloads.PayloadTermQuery; //导入方法依赖的package包/类
private List<Query> getMathQueries(Map<String, Float> queryForms, MathTokenizer.MathMLType type) {
String field = (type == MathTokenizer.MathMLType.PRESENTATION ? "p" : "c") + "math";
List<Query> result = new ArrayList<>();
Iterator<Map.Entry<String, Float>> it = queryForms.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Float> entry = it.next();
Float boost = entry.getValue();
PayloadTermQuery ptq = new PayloadTermQuery(new Term(field, entry.getKey()), new AveragePayloadFunction());
ptq.setBoost(boost);
result.add(ptq);
}
return result;
}