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

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

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

BooleanQuery.createWeight介绍

暂无

代码示例

代码示例来源:origin: lucene/lucene

protected Weight createWeight(Searcher searcher) {
 if (termArrays.size() == 1) {                 // optimize one-term case
  Term[] terms = (Term[])termArrays.get(0);
  BooleanQuery boq = new BooleanQuery();
  for (int i=0; i<terms.length; i++) {
   boq.add(new TermQuery(terms[i]), false, false);
  }
  boq.setBoost(getBoost());
  return boq.createWeight(searcher);
 }
 return new PhrasePrefixWeight(searcher);
}

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

@Override
public Weight doCreateWeight(IndexSearcher searcher, boolean needsScores) throws IOException {
  if (searcher.getIndexReader().numDocs() == 0) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
  }
  IndexParentChildFieldData globalIfd = parentChildIndexFieldData.loadGlobal((DirectoryReader)searcher.getIndexReader());
  final long maxOrd;
  List<LeafReaderContext> leaves = searcher.getIndexReader().leaves();
  if (globalIfd == null || leaves.isEmpty()) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
  } else {
    AtomicParentChildFieldData afd = globalIfd.load(leaves.get(0));
    SortedDocValues globalValues = afd.getOrdinalsValues(parentType);
    maxOrd = globalValues.getValueCount();
  }
  if (maxOrd == 0) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
  }
  ParentOrdsCollector collector = new ParentOrdsCollector(globalIfd, maxOrd, parentType);
  searcher.search(parentQuery, collector);
  if (collector.parentCount() == 0) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
  }
  return new ChildrenWeight(this, childrenFilter, collector, globalIfd);
}

代码示例来源:origin: org.xcmis/xcmis-search-service

currentContextScorer = bq.createWeight(searcher).scorer(reader, scoreDocsInOrder, topScorer);

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

@Override
public Weight doCreateWeight(IndexSearcher searcher, boolean needsScores) throws IOException {
  if (searcher.getIndexReader().numDocs() == 0) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
  List<LeafReaderContext> leaves = searcher.getIndexReader().leaves();
  if (globalIfd == null || leaves.isEmpty()) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
  } else {
    AtomicParentChildFieldData afd = globalIfd.load(leaves.get(0));
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);

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

@Override
public Weight doCreateWeight(IndexSearcher searcher, boolean needsScores) throws IOException {
  if (searcher.getIndexReader().numDocs() == 0) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
  if (globalIfd == null) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
    searcher.search(parentQuery, collector);
    if (collector.parentCount() == 0) {
      return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);

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

@Override
public Weight doCreateWeight(IndexSearcher searcher, boolean needsScores) throws IOException {
  if (searcher.getIndexReader().numDocs() == 0) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
  if (globalIfd == null) {
    return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);
    numFoundParents = collector.foundParents();
    if (numFoundParents == 0) {
      return new BooleanQuery.Builder().build().createWeight(searcher, needsScores);

相关文章