private void Count(ValueSource valueSource, IList<MatchingDocs> matchingDocs) { LongRange[] ranges = (LongRange[])this.ranges; LongRangeCounter counter = new LongRangeCounter(ranges); int missingCount = 0; foreach (MatchingDocs hits in matchingDocs) { FunctionValues fv = valueSource.GetValues(new Dictionary<string, object>(), 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.GetBits(); if (bits == null) { throw new System.ArgumentException("fastMatchFilter does not implement DocIdSet.bits"); } } else { bits = null; } DocIdSetIterator docs = hits.Bits.GetIterator(); 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; }
private void Count(ValueSource valueSource, IList <MatchingDocs> matchingDocs) { LongRange[] ranges = (LongRange[])this.ranges; LongRangeCounter counter = new LongRangeCounter(ranges); int missingCount = 0; foreach (MatchingDocs hits in matchingDocs) { FunctionValues fv = valueSource.GetValues(new Dictionary <string, object>(), 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.GetBits(); if (bits == null) { throw new System.ArgumentException("fastMatchFilter does not implement DocIdSet.bits"); } } else { bits = null; } DocIdSetIterator docs = hits.Bits.GetIterator(); 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; }
private void Count(ValueSource valueSource, IEnumerable<MatchingDocs> matchingDocs) { 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; foreach (MatchingDocs hits in matchingDocs) { FunctionValues fv = valueSource.GetValues(new Dictionary<string, object>(), 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.GetBits(); if (bits == null) { throw new System.ArgumentException("fastMatchFilter does not implement DocIdSet.bits"); } } else { bits = null; } DocIdSetIterator docs = hits.Bits.GetIterator(); 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; }
private void Count(ValueSource valueSource, IEnumerable <MatchingDocs> matchingDocs) { 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; foreach (MatchingDocs hits in matchingDocs) { FunctionValues fv = valueSource.GetValues(new Dictionary <string, object>(), 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.GetBits(); if (bits == null) { throw new System.ArgumentException("fastMatchFilter does not implement DocIdSet.bits"); } } else { bits = null; } DocIdSetIterator docs = hits.Bits.GetIterator(); 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; }