本文整理匯總了Java中org.apache.lucene.queries.BlendedTermQuery.commonTermsBlendedQuery方法的典型用法代碼示例。如果您正苦於以下問題:Java BlendedTermQuery.commonTermsBlendedQuery方法的具體用法?Java BlendedTermQuery.commonTermsBlendedQuery怎麽用?Java BlendedTermQuery.commonTermsBlendedQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.lucene.queries.BlendedTermQuery
的用法示例。
在下文中一共展示了BlendedTermQuery.commonTermsBlendedQuery方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: blendTerm
import org.apache.lucene.queries.BlendedTermQuery; //導入方法依賴的package包/類
public Query blendTerm(Term term, MappedFieldType fieldType) {
if (blendedFields == null) {
return super.blendTerm(term, fieldType);
}
final Term[] terms = new Term[blendedFields.length];
float[] blendedBoost = new float[blendedFields.length];
for (int i = 0; i < blendedFields.length; i++) {
terms[i] = blendedFields[i].newTerm(term.text());
blendedBoost[i] = blendedFields[i].boost;
}
if (options.commonTermsCutoff() != null) {
return BlendedTermQuery.commonTermsBlendedQuery(
terms, blendedBoost, false, options.commonTermsCutoff());
}
if (tieBreaker == 1.0f) {
return BlendedTermQuery.booleanBlendedQuery(terms, blendedBoost, false);
}
return BlendedTermQuery.dismaxBlendedQuery(terms, blendedBoost, tieBreaker);
}
示例2: blendTerm
import org.apache.lucene.queries.BlendedTermQuery; //導入方法依賴的package包/類
@Override
public Query blendTerm(Term term, MappedFieldType fieldType) {
if (blendedFields == null) {
return super.blendTerm(term, fieldType);
}
final Term[] terms = new Term[blendedFields.length];
float[] blendedBoost = new float[blendedFields.length];
for (int i = 0; i < blendedFields.length; i++) {
terms[i] = blendedFields[i].newTerm(term.text());
blendedBoost[i] = blendedFields[i].boost;
}
if (commonTermsCutoff != null) {
return BlendedTermQuery.commonTermsBlendedQuery(terms, blendedBoost, false, commonTermsCutoff);
}
if (tieBreaker == 1.0f) {
return BlendedTermQuery.booleanBlendedQuery(terms, blendedBoost, false);
}
return BlendedTermQuery.dismaxBlendedQuery(terms, blendedBoost, tieBreaker);
}