本文整理汇总了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)");
}