コード例 #1
0
ファイル: CachingWrapperFilter.cs プロジェクト: yonder/mono
        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);
        }
コード例 #2
0
        // 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()));
        }
コード例 #3
0
        // 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);
        }
コード例 #4
0
		// 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);
		}
コード例 #5
0
		// 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());
		}