当前位置: 首页>>代码示例>>Java>>正文


Java MatchingDocs类代码示例

本文整理汇总了Java中org.apache.lucene.facet.FacetsCollector.MatchingDocs的典型用法代码示例。如果您正苦于以下问题:Java MatchingDocs类的具体用法?Java MatchingDocs怎么用?Java MatchingDocs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MatchingDocs类属于org.apache.lucene.facet.FacetsCollector包,在下文中一共展示了MatchingDocs类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: count

import org.apache.lucene.facet.FacetsCollector.MatchingDocs; //导入依赖的package包/类
private final void count(List<MatchingDocs> matchingDocs) throws IOException {
  IntsRef scratch  = new IntsRef();
  for(MatchingDocs hits : matchingDocs) {
    OrdinalsReader.OrdinalsSegmentReader ords = ordinalsReader.getReader(hits.context);
    DocIdSetIterator docs = hits.bits.iterator();
    
    int doc;
    while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
      ords.get(doc, scratch);
      for(int i=0;i<scratch.length;i++) {
        values[scratch.ints[scratch.offset+i]]++;
      }
    }
  }

  rollup();
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:TaxonomyFacetCounts.java

示例2: count

import org.apache.lucene.facet.FacetsCollector.MatchingDocs; //导入依赖的package包/类
private final void count(List<MatchingDocs> matchingDocs) throws IOException {
    IntsRef scratch = new IntsRef();
    OrdinalsReader.OrdinalsSegmentReader[] ordsReaders = new OrdinalsReader.OrdinalsSegmentReader[this.ordinalsReaders.size()];
    for (MatchingDocs hits : matchingDocs) {
        for (int i = 0; i < ordsReaders.length; i++) {
            ordsReaders[i] = this.ordinalsReaders.get(i).getReader(hits.context);
        }
        DocIdSetIterator docs = hits.bits.iterator();
        int doc;
        while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
            for (OrdinalsReader.OrdinalsSegmentReader ords : ordsReaders) {
                ords.get(doc, scratch);
                for (int i = 0; i < scratch.length; i++) {
                    values[scratch.ints[scratch.offset + i]]++;
                }
            }
        }
    }

    rollup();
}
 
开发者ID:seecr,项目名称:meresco-lucene,代码行数:22,代码来源:MerescoTaxonomyFacetCounts.java

示例3: sumValues

import org.apache.lucene.facet.FacetsCollector.MatchingDocs; //导入依赖的package包/类
private final void sumValues(List<MatchingDocs> matchingDocs, boolean keepScores, ValueSource valueSource) throws IOException {
  final FakeScorer scorer = new FakeScorer();
  Map<String, Scorer> context = new HashMap<>();
  if (keepScores) {
    context.put("scorer", scorer);
  }
  IntsRef scratch = new IntsRef();
  for(MatchingDocs hits : matchingDocs) {
    OrdinalsReader.OrdinalsSegmentReader ords = ordinalsReader.getReader(hits.context);
    
    int scoresIdx = 0;
    float[] scores = hits.scores;

    FunctionValues functionValues = valueSource.getValues(context, hits.context);
    DocIdSetIterator docs = hits.bits.iterator();
    
    int doc;
    while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
      ords.get(doc, scratch);
      if (keepScores) {
        scorer.docID = doc;
        scorer.score = scores[scoresIdx++];
      }
      float value = (float) functionValues.doubleVal(doc);
      for(int i=0;i<scratch.length;i++) {
        values[scratch.ints[i]] += value;
      }
    }
  }

  rollup();
}
 
开发者ID:europeana,项目名称:search,代码行数:33,代码来源:TaxonomyFacetSumValueSource.java

示例4: sumValues

import org.apache.lucene.facet.FacetsCollector.MatchingDocs; //导入依赖的package包/类
private final void sumValues(List<MatchingDocs> matchingDocs, boolean keepScores, ValueSource valueSource) throws IOException {
  final FakeScorer scorer = new FakeScorer();
  Map<String, Scorer> context = new HashMap<String, Scorer>();
  if (keepScores) {
    context.put("scorer", scorer);
  }
  IntsRef scratch = new IntsRef();
  for(MatchingDocs hits : matchingDocs) {
    OrdinalsReader.OrdinalsSegmentReader ords = ordinalsReader.getReader(hits.context);
    
    int scoresIdx = 0;
    float[] scores = hits.scores;

    FunctionValues functionValues = valueSource.getValues(context, hits.context);
    DocIdSetIterator docs = hits.bits.iterator();
    
    int doc;
    while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
      ords.get(doc, scratch);
      if (keepScores) {
        scorer.docID = doc;
        scorer.score = scores[scoresIdx++];
      }
      float value = (float) functionValues.doubleVal(doc);
      for(int i=0;i<scratch.length;i++) {
        values[scratch.ints[i]] += value;
      }
    }
  }

  rollup();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:33,代码来源:TaxonomyFacetSumValueSource.java

示例5: count

import org.apache.lucene.facet.FacetsCollector.MatchingDocs; //导入依赖的package包/类
private void count(ValueSource valueSource, List<MatchingDocs> matchingDocs) throws IOException {

    DoubleRange[] ranges = (DoubleRange[]) this.ranges;

    LongRange[] longRanges = new LongRange[ranges.length];
    for(int i=0;i<ranges.length;i++) {
      DoubleRange range = ranges[i];
      longRanges[i] =  new LongRange(range.label,
                                     NumericUtils.doubleToSortableLong(range.minIncl), true,
                                     NumericUtils.doubleToSortableLong(range.maxIncl), true);
    }

    LongRangeCounter counter = new LongRangeCounter(longRanges);

    int missingCount = 0;
    for (MatchingDocs hits : matchingDocs) {
      FunctionValues fv = valueSource.getValues(Collections.emptyMap(), hits.context);
      
      totCount += hits.totalHits;
      Bits bits;
      if (fastMatchFilter != null) {
        DocIdSet dis = fastMatchFilter.getDocIdSet(hits.context, null);
        if (dis == null) {
          // No documents match
          continue;
        }
        bits = dis.bits();
        if (bits == null) {
          throw new IllegalArgumentException("fastMatchFilter does not implement DocIdSet.bits");
        }
      } else {
        bits = null;
      }

      DocIdSetIterator docs = hits.bits.iterator();
      
      int doc;
      while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
        if (bits != null && bits.get(doc) == false) {
          doc++;
          continue;
        }
        // Skip missing docs:
        if (fv.exists(doc)) {
          counter.add(NumericUtils.doubleToSortableLong(fv.doubleVal(doc)));
        } else {
          missingCount++;
        }
      }
    }

    missingCount += counter.fillCounts(counts);
    totCount -= missingCount;
  }
 
开发者ID:europeana,项目名称:search,代码行数:55,代码来源:DoubleRangeFacetCounts.java

示例6: count

import org.apache.lucene.facet.FacetsCollector.MatchingDocs; //导入依赖的package包/类
private void count(ValueSource valueSource, List<MatchingDocs> matchingDocs) throws IOException {

    LongRange[] ranges = (LongRange[]) this.ranges;

    LongRangeCounter counter = new LongRangeCounter(ranges);

    int missingCount = 0;
    for (MatchingDocs hits : matchingDocs) {
      FunctionValues fv = valueSource.getValues(Collections.emptyMap(), hits.context);
      
      totCount += hits.totalHits;
      Bits bits;
      if (fastMatchFilter != null) {
        DocIdSet dis = fastMatchFilter.getDocIdSet(hits.context, null);
        if (dis == null) {
          // No documents match
          continue;
        }
        bits = dis.bits();
        if (bits == null) {
          throw new IllegalArgumentException("fastMatchFilter does not implement DocIdSet.bits");
        }
      } else {
        bits = null;
      }

      DocIdSetIterator docs = hits.bits.iterator();      
      int doc;
      while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
        if (bits != null && bits.get(doc) == false) {
          doc++;
          continue;
        }
        // Skip missing docs:
        if (fv.exists(doc)) {
          counter.add(fv.longVal(doc));
        } else {
          missingCount++;
        }
      }
    }
    
    int x = counter.fillCounts(counts);

    missingCount += x;

    //System.out.println("totCount " + totCount + " missingCount " + counter.missingCount);
    totCount -= missingCount;
  }
 
开发者ID:europeana,项目名称:search,代码行数:50,代码来源:LongRangeFacetCounts.java


注:本文中的org.apache.lucene.facet.FacetsCollector.MatchingDocs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。