// inherit javadoc public override TopFieldDocs Search(Query query, Filter filter, int nDocs, Sort sort) { Scorer scorer = query.Weight(this).Scorer(reader); if (scorer == null) { return(new TopFieldDocs(0, new ScoreDoc[0], sort.fields)); } System.Collections.BitArray bits = filter != null?filter.Bits(reader) : null; FieldSortedHitQueue hq = new FieldSortedHitQueue(reader, sort.fields, nDocs); int[] totalHits = new int[1]; scorer.Score(new AnonymousClassHitCollector1(bits, totalHits, hq, this)); ScoreDoc[] scoreDocs = new ScoreDoc[hq.Size()]; for (int i = hq.Size() - 1; i >= 0; i--) { // put docs in array scoreDocs[i] = hq.FillFields((FieldDoc)hq.Pop()); } return(new TopFieldDocs(totalHits[0], scoreDocs, hq.GetFields())); }
// inherit javadoc public override TopFieldDocs Search(Query query, Filter filter, int nDocs, Sort sort) { Scorer scorer = query.Weight(this).Scorer(reader); if (scorer == null) return new TopFieldDocs(0, new ScoreDoc[0], sort.fields); System.Collections.BitArray bits = filter != null ? filter.Bits(reader) : null; FieldSortedHitQueue hq = new FieldSortedHitQueue(reader, sort.fields, nDocs); int[] totalHits = new int[1]; scorer.Score(new AnonymousClassHitCollector1(bits, totalHits, hq, this)); ScoreDoc[] scoreDocs = new ScoreDoc[hq.Size()]; for (int i = hq.Size() - 1; i >= 0; i--) // put docs in array scoreDocs[i] = hq.FillFields((FieldDoc) hq.Pop()); return new TopFieldDocs(totalHits[0], scoreDocs, hq.GetFields()); }