本文整理匯總了Java中org.apache.lucene.search.BooleanClause.Occur.MUST_NOT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Occur.MUST_NOT屬性的具體用法?Java Occur.MUST_NOT怎麽用?Java Occur.MUST_NOT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.lucene.search.BooleanClause.Occur
的用法示例。
在下文中一共展示了Occur.MUST_NOT屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: _queryClauseJoinFor
private static Occur _queryClauseJoinFor(final QueryClauseOccur occur) {
Occur outOccur = null;
switch(occur) {
case MUST:
outOccur = Occur.MUST;
break;
case MUST_NOT:
outOccur = Occur.MUST_NOT;
break;
case SHOULD:
outOccur = Occur.SHOULD;
break;
default:
throw new IllegalArgumentException();
}
return outOccur;
}
示例2: extractTerms
@Override
public void extractTerms(Set<Term> terms) {
for (BooleanClause clause : clauses) {
if (clause.getOccur() != Occur.MUST_NOT) {
clause.getQuery().extractTerms(terms);
}
}
}
示例3: CommonTermsQuery
/**
* Creates a new {@link CommonTermsQuery}
*
* @param highFreqOccur
* {@link Occur} used for high frequency terms
* @param lowFreqOccur
* {@link Occur} used for low frequency terms
* @param maxTermFrequency
* a value in [0..1) (or absolute number >=1) representing the
* maximum threshold of a terms document frequency to be considered a
* low frequency term.
* @param disableCoord
* disables {@link Similarity#coord(int,int)} in scoring for the low
* / high frequency sub-queries
* @throws IllegalArgumentException
* if {@link Occur#MUST_NOT} is pass as lowFreqOccur or
* highFreqOccur
*/
public CommonTermsQuery(Occur highFreqOccur, Occur lowFreqOccur,
float maxTermFrequency, boolean disableCoord) {
if (highFreqOccur == Occur.MUST_NOT) {
throw new IllegalArgumentException(
"highFreqOccur should be MUST or SHOULD but was MUST_NOT");
}
if (lowFreqOccur == Occur.MUST_NOT) {
throw new IllegalArgumentException(
"lowFreqOccur should be MUST or SHOULD but was MUST_NOT");
}
this.disableCoord = disableCoord;
this.highFreqOccur = highFreqOccur;
this.lowFreqOccur = lowFreqOccur;
this.maxTermFrequency = maxTermFrequency;
}
示例4: mustNot
public WebDSLFacet mustNot(){
occur = Occur.MUST_NOT;
return this;
}
示例5: toOccur
public static Occur toOccur(boolean required, boolean prohibited) {
if(required && !prohibited) return Occur.MUST;
if(!required && !prohibited) return Occur.SHOULD;
if(!required && prohibited) return Occur.MUST_NOT;
throw new RuntimeException("invalid Occur definition (required and prohibited)");
}