org.apache.lucene.search.BooleanQuery.iterator()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.apache.lucene.search.BooleanQuery.iterator()方法的一些代码示例,展示了BooleanQuery.iterator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanQuery.iterator()方法的具体详情如下:
包路径:org.apache.lucene.search.BooleanQuery
类名称:BooleanQuery
方法名:iterator

BooleanQuery.iterator介绍

[英]Returns an iterator on the clauses in this query. It implements the Iterable interface to make it possible to do:

for (BooleanClause clause : booleanQuery) {}

[中]返回此查询中子句的迭代器。它实现了Iterable接口,从而可以执行以下操作:

for (BooleanClause clause : booleanQuery) {}

代码示例

代码示例来源: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

Iterator<BooleanClause> cIter = query.iterator();
for (Weight w  : weights) {
 BooleanClause c =  cIter.next();

代码示例来源:origin: org.apache.lucene/lucene-core

private BulkScorer requiredBulkScorer(LeafReaderContext context) throws IOException {
 BulkScorer scorer = null;
 Iterator<BooleanClause> cIter = query.iterator();
 for (Weight w  : weights) {
  BooleanClause c =  cIter.next();
  if (c.isRequired() == false) {
   continue;
  }
  if (scorer != null) {
   // we don't have a BulkScorer for conjunctions
   return null;
  }
  scorer = w.bulkScorer(context);
  if (scorer == null) {
   // no matches
   return null;
  }
  if (c.isScoring() == false && needsScores) {
   scorer = disableScoring(scorer);
  }
 }
 return scorer;
}

代码示例来源:origin: org.apache.lucene/lucene-core

Iterator<BooleanClause> cIter = query.iterator();
for (Weight w  : weights) {
 BooleanClause c =  cIter.next();

代码示例来源:origin: org.apache.lucene/lucene-core

int matchCount = 0;
int shouldMatchCount = 0;
Iterator<BooleanClause> cIter = query.iterator();
for (Iterator<Weight> wIter = weights.iterator(); wIter.hasNext();) {
 Weight w = wIter.next();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

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.servicemix.bundles/org.apache.servicemix.bundles.lucene

Iterator<BooleanClause> cIter = query.iterator();
for (Weight w  : weights) {
 BooleanClause c =  cIter.next();

代码示例来源:origin: harbby/presto-connectors

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) {
  BulkScorer opt = optional.get(0);
  if (!disableCoord && maxCoord > 1) {
   return new BooleanTopLevelScorers.BoostedBulkScorer(opt, coord(1, maxCoord));
  } else {
   return opt;
  }
 }
 return new BooleanScorer(this, disableCoord, maxCoord, optional, Math.max(1, query.getMinimumNumberShouldMatch()), needsScores);
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

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) {
  BulkScorer opt = optional.get(0);
  if (!disableCoord && maxCoord > 1) {
   return new BooleanTopLevelScorers.BoostedBulkScorer(opt, coord(1, maxCoord));
  } else {
   return opt;
  }
 }
 return new BooleanScorer(this, disableCoord, maxCoord, optional, Math.max(1, query.getMinimumNumberShouldMatch()), needsScores);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

private BulkScorer requiredBulkScorer(LeafReaderContext context) throws IOException {
 BulkScorer scorer = null;
 Iterator<BooleanClause> cIter = query.iterator();
 for (Weight w  : weights) {
  BooleanClause c =  cIter.next();
  if (c.isRequired() == false) {
   continue;
  }
  if (scorer != null) {
   // we don't have a BulkScorer for conjunctions
   return null;
  }
  scorer = w.bulkScorer(context);
  if (scorer == null) {
   // no matches
   return null;
  }
  if (c.isScoring() == false && needsScores) {
   scorer = disableScoring(scorer);
  }
 }
 return scorer;
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private BulkScorer requiredBulkScorer(LeafReaderContext context) throws IOException {
 BulkScorer scorer = null;
 Iterator<BooleanClause> cIter = query.iterator();
 for (Weight w  : weights) {
  BooleanClause c =  cIter.next();
  if (c.isRequired() == false) {
   continue;
  }
  if (scorer != null) {
   // we don't have a BulkScorer for conjunctions
   return null;
  }
  scorer = w.bulkScorer(context);
  if (scorer == null) {
   // no matches
   return null;
  }
  if (c.isScoring() == false) {
   if (needsScores) {
    scorer = disableScoring(scorer);
   }
  } else {
   assert maxCoord == 1;
  }
 }
 return scorer;
}

代码示例来源:origin: harbby/presto-connectors

private BulkScorer requiredBulkScorer(LeafReaderContext context) throws IOException {
 BulkScorer scorer = null;
 Iterator<BooleanClause> cIter = query.iterator();
 for (Weight w  : weights) {
  BooleanClause c =  cIter.next();
  if (c.isRequired() == false) {
   continue;
  }
  if (scorer != null) {
   // we don't have a BulkScorer for conjunctions
   return null;
  }
  scorer = w.bulkScorer(context);
  if (scorer == null) {
   // no matches
   return null;
  }
  if (c.isScoring() == false) {
   if (needsScores) {
    scorer = disableScoring(scorer);
   }
  } else {
   assert maxCoord == 1;
  }
 }
 return scorer;
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

List<Scorer> prohibited = new ArrayList<>();
List<Scorer> optional = new ArrayList<>();
Iterator<BooleanClause> cIter = query.iterator();
for (Weight w  : weights) {
 BooleanClause c =  cIter.next();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

Iterator<BooleanClause> cIter = query.iterator();
for (Weight w  : weights) {
 BooleanClause c =  cIter.next();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

int matchCount = 0;
int shouldMatchCount = 0;
Iterator<BooleanClause> cIter = query.iterator();
for (Iterator<Weight> wIter = weights.iterator(); wIter.hasNext();) {
 Weight w = wIter.next();

代码示例来源:origin: org.infinispan/infinispan-embedded-query

Iterator<BooleanClause> cIter = query.iterator();
for (Weight w  : weights) {
 BooleanClause c =  cIter.next();

代码示例来源:origin: harbby/presto-connectors

Iterator<BooleanClause> cIter = query.iterator();
for (Weight w  : weights) {
 BooleanClause c =  cIter.next();

代码示例来源:origin: org.infinispan/infinispan-embedded-query

int matchCount = 0;
int shouldMatchCount = 0;
Iterator<BooleanClause> cIter = query.iterator();
for (Iterator<Weight> wIter = weights.iterator(); wIter.hasNext();) {
 Weight w = wIter.next();

代码示例来源:origin: stackoverflow.com

Iterator<BooleanClause> iterator = bq.iterator();
while(iterator.hasNext())

代码示例来源:origin: harbby/presto-connectors

int matchCount = 0;
int shouldMatchCount = 0;
Iterator<BooleanClause> cIter = query.iterator();
for (Iterator<Weight> wIter = weights.iterator(); wIter.hasNext();) {
 Weight w = wIter.next();

相关文章