本文整理了Java中org.apache.lucene.search.BooleanQuery.getMinimumNumberShouldMatch()
方法的一些代码示例,展示了BooleanQuery.getMinimumNumberShouldMatch()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanQuery.getMinimumNumberShouldMatch()
方法的具体详情如下:
包路径:org.apache.lucene.search.BooleanQuery
类名称:BooleanQuery
方法名:getMinimumNumberShouldMatch
[英]Gets the minimum number of the optional BooleanClauses which must be satisfied.
[中]获取必须满足的可选布尔子句的最小数目。
代码示例来源:origin: org.apache.lucene/lucene-core
private boolean equalsTo(BooleanQuery other) {
return getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch() &&
clauseSets.equals(other.clauseSets);
}
代码示例来源:origin: org.apache.lucene/lucene-core
BulkScorer optionalBulkScorer(LeafReaderContext context) throws IOException {
List<BulkScorer> optional = new ArrayList<BulkScorer>();
Iterator<BooleanClause> cIter = query.iterator();
for (Weight w : weights) {
BooleanClause c = cIter.next();
if (c.getOccur() != Occur.SHOULD) {
continue;
}
BulkScorer subScorer = w.bulkScorer(context);
if (subScorer != null) {
optional.add(subScorer);
}
}
if (optional.size() == 0) {
return null;
}
if (query.getMinimumNumberShouldMatch() > optional.size()) {
return null;
}
if (optional.size() == 1) {
return optional.get(0);
}
return new BooleanScorer(this, optional, Math.max(1, query.getMinimumNumberShouldMatch()), needsScores);
}
代码示例来源:origin: org.apache.lucene/lucene-core
public String toString(String field) {
StringBuilder buffer = new StringBuilder();
boolean needParens = getMinimumNumberShouldMatch() > 0;
if (needParens) {
buffer.append("(");
if (getMinimumNumberShouldMatch()>0) {
buffer.append('~');
buffer.append(getMinimumNumberShouldMatch());
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public ScorerSupplier scorerSupplier(LeafReaderContext context) throws IOException {
int minShouldMatch = query.getMinimumNumberShouldMatch();
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public Matches matches(LeafReaderContext context, int doc) throws IOException {
final int minShouldMatch = query.getMinimumNumberShouldMatch();
List<Matches> matches = new ArrayList<>();
int shouldMatchCount = 0;
代码示例来源:origin: org.apache.lucene/lucene-core
private BooleanQuery rewriteNoScoring() {
if (clauseSets.get(Occur.MUST).size() == 0) {
return this;
}
BooleanQuery.Builder newQuery = new BooleanQuery.Builder();
newQuery.setMinimumNumberShouldMatch(getMinimumNumberShouldMatch());
for (BooleanClause clause : clauses) {
if (clause.getOccur() == Occur.MUST) {
newQuery.add(clause.getQuery(), Occur.FILTER);
} else {
newQuery.add(clause);
}
}
return newQuery.build();
}
代码示例来源:origin: org.apache.lucene/lucene-core
if (query.getMinimumNumberShouldMatch() <= 1) {
&& query.getMinimumNumberShouldMatch() == 0) {
positiveScorer = requiredBulkScorer(context);
} else {
代码示例来源:origin: org.apache.lucene/lucene-core
builder.setMinimumNumberShouldMatch(getMinimumNumberShouldMatch());
boolean actuallyRewritten = false;
for (BooleanClause clause : this) {
if (modified) {
BooleanQuery.Builder builder = new BooleanQuery.Builder();
builder.setMinimumNumberShouldMatch(getMinimumNumberShouldMatch());
for (BooleanClause clause : clauses) {
if (clause.getOccur() != Occur.FILTER) {
int minShouldMatch = getMinimumNumberShouldMatch();
.setMinimumNumberShouldMatch(getMinimumNumberShouldMatch())
.add(rewritten, Occur.MUST);
for (Query query : clauseSets.get(Occur.SHOULD)) {
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public Explanation explain(LeafReaderContext context, int doc) throws IOException {
final int minShouldMatch = query.getMinimumNumberShouldMatch();
List<Explanation> subs = new ArrayList<>();
float sum = 0.0f;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
private boolean equalsTo(BooleanQuery other) {
return getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch() &&
clauseSets.equals(other.clauseSets);
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
/** Returns a hash code value for this object.*/
public int hashCode() {
return Float.floatToIntBits(getBoost()) ^ clauses.hashCode()
+ getMinimumNumberShouldMatch();
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
/** Returns a hash code value for this object.*/
public int hashCode() {
return Float.floatToIntBits(getBoost()) ^ clauses.hashCode()
+ getMinimumNumberShouldMatch();
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
/** Returns true iff <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (!(o instanceof BooleanQuery))
return false;
BooleanQuery other = (BooleanQuery)o;
return (this.getBoost() == other.getBoost())
&& this.clauses.equals(other.clauses)
&& this.getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch();
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
/** Returns true iff <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (!(o instanceof BooleanQuery))
return false;
BooleanQuery other = (BooleanQuery)o;
return (this.getBoost() == other.getBoost())
&& this.clauses.equals(other.clauses)
&& this.getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch();
}
代码示例来源:origin: org.infinispan/infinispan-query
@Override
public void writeObject(final ObjectOutput output, final BooleanQuery query) throws IOException {
output.writeBoolean(query.isCoordDisabled());
output.writeFloat(query.getBoost());
UnsignedNumeric.writeUnsignedInt(output, query.getMinimumNumberShouldMatch());
final List<BooleanClause> booleanClauses = query.clauses();
final int numberOfClauses = booleanClauses.size();
UnsignedNumeric.writeUnsignedInt(output, numberOfClauses);
for (BooleanClause booleanClause : booleanClauses) {
writeClause(output, booleanClause);
}
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
@Override
public void writeObject(final ObjectOutput output, final BooleanQuery query) throws IOException {
output.writeBoolean(query.isCoordDisabled());
output.writeFloat(query.getBoost());
UnsignedNumeric.writeUnsignedInt(output, query.getMinimumNumberShouldMatch());
final List<BooleanClause> booleanClauses = query.clauses();
final int numberOfClauses = booleanClauses.size();
UnsignedNumeric.writeUnsignedInt(output, numberOfClauses);
for (BooleanClause booleanClause : booleanClauses) {
writeClause(output, booleanClause);
}
}
代码示例来源:origin: harbby/presto-connectors
private static BooleanQuery addClause(BooleanQuery bq, Query query, BooleanClause.Occur occur) {
BooleanQuery.Builder newBq = new BooleanQuery.Builder();
newBq.setDisableCoord(bq.isCoordDisabled());
newBq.setMinimumNumberShouldMatch(bq.getMinimumNumberShouldMatch());
for (BooleanClause clause : bq) {
newBq.add(clause);
}
newBq.add(query, occur);
return newBq.build();
}
代码示例来源:origin: flaxsearch/luwak
protected Query rewriteBoolean(BooleanQuery bq, IndexSearcher searcher) throws RewriteException, IOException {
BooleanQuery.Builder newbq = new BooleanQuery.Builder();
newbq.setMinimumNumberShouldMatch(bq.getMinimumNumberShouldMatch());
for (BooleanClause clause : bq) {
BooleanClause.Occur occur = clause.getOccur();
if (occur == BooleanClause.Occur.FILTER)
occur = BooleanClause.Occur.MUST; // rewrite FILTER to MUST to ensure scoring
newbq.add(rewrite(clause.getQuery(), searcher), occur);
}
return newbq.build();
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
private static BooleanQuery addClause(BooleanQuery bq, Query query, BooleanClause.Occur occur) {
BooleanQuery.Builder newBq = new BooleanQuery.Builder();
newBq.setDisableCoord(bq.isCoordDisabled());
newBq.setMinimumNumberShouldMatch(bq.getMinimumNumberShouldMatch());
for (BooleanClause clause : bq) {
newBq.add(clause);
}
newBq.add(query, occur);
return newBq.build();
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
private BooleanQuery rewriteNoScoring() {
BooleanQuery.Builder newQuery = new BooleanQuery.Builder();
// ignore disableCoord, which only matters for scores
newQuery.setMinimumNumberShouldMatch(getMinimumNumberShouldMatch());
for (BooleanClause clause : clauses) {
if (clause.getOccur() == Occur.MUST) {
newQuery.add(clause.getQuery(), Occur.FILTER);
} else {
newQuery.add(clause);
}
}
return newQuery.build();
}
内容来源于网络,如有侵权,请联系作者删除!