public override System.Collections.BitArray Bits(Monodoc.Lucene.Net.Index.IndexReader reader) { if (cache == null) { cache = new System.Collections.Hashtable(); } lock (cache.SyncRoot) { // check cache System.Collections.BitArray cached = (System.Collections.BitArray)cache[reader]; if (cached != null) { return(cached); } } System.Collections.BitArray bits = filter.Bits(reader); lock (cache.SyncRoot) { // update cache cache[reader] = bits; } return(bits); }
// 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 void Search(Query query, Filter filter, HitCollector results) { HitCollector collector = results; if (filter != null) { System.Collections.BitArray bits = filter.Bits(reader); collector = new AnonymousClassHitCollector2(bits, results, this); } Scorer scorer = query.Weight(this).Scorer(reader); if (scorer == null) { return; } scorer.Score(collector); }
// inherit javadoc public override void Search(Query query, Filter filter, HitCollector results) { HitCollector collector = results; if (filter != null) { System.Collections.BitArray bits = filter.Bits(reader); collector = new AnonymousClassHitCollector2(bits, results, this); } Scorer scorer = query.Weight(this).Scorer(reader); if (scorer == null) return ; scorer.Score(collector); }
// 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()); }