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