/// <summary> Create a TimeLimitedCollector wrapper over another HitCollector with a specified timeout.</summary>
 /// <param name="hc">the wrapped HitCollector
 /// </param>
 /// <param name="timeAllowed">max time allowed for collecting hits after which {@link TimeExceededException} is thrown
 /// </param>
 public TimeLimitedCollector(HitCollector hc, long timeAllowed)
 {
     InitBlock();
     this.hc = hc;
     t0 = TIMER_THREAD.GetMilliseconds();
     this.timeout = t0 + timeAllowed;
 }
Exemplo n.º 2
0
        protected internal override bool Score(HitCollector c, int end)
        {
            Similarity similarity = GetSimilarity();             // cache sim in local

            float[] normDecoder = Similarity.GetNormDecoder();
            while (doc < end)
            {
                // for docs in window
                int   f     = freqs[pointer];
                float score = f < SCORE_CACHE_SIZE?scoreCache[f]:similarity.Tf(f) * weightValue; // cache miss

                score *= normDecoder[norms[doc] & 0xFF];                                         // normalize for field

                c.Collect(doc, score);                                                           // collect score

                if (++pointer >= pointerMax)
                {
                    pointerMax = termDocs.Read(docs, freqs);                     // refill buffers
                    if (pointerMax != 0)
                    {
                        pointer = 0;
                    }
                    else
                    {
                        termDocs.Close();                         // close stream
                        doc = System.Int32.MaxValue;              // set to sentinel value
                        return(false);
                    }
                }
                doc = docs[pointer];
            }
            return(true);
        }
Exemplo n.º 3
0
 /// <summary>Scores and collects all matching documents.</summary>
 /// <param name="hc">The collector to which all matching documents are passed through
 /// {@link HitCollector#Collect(int, float)}.
 /// <br>When this method is used the {@link #Explain(int)} method should not be used.
 /// </param>
 public override void  Score(HitCollector hc)
 {
     if (allowDocsOutOfOrder && requiredScorers.Count == 0 && prohibitedScorers.Count < 32)
     {
         // fall back to BooleanScorer, scores documents somewhat out of order
         BooleanScorer bs = new BooleanScorer(GetSimilarity(), minNrShouldMatch);
         System.Collections.IEnumerator si = optionalScorers.GetEnumerator();
         while (si.MoveNext())
         {
             bs.Add((Scorer)si.Current, false, false);
         }
         si = prohibitedScorers.GetEnumerator();
         while (si.MoveNext())
         {
             bs.Add((Scorer)si.Current, false, true);
         }
         bs.Score(hc);
     }
     else
     {
         if (countingSumScorer == null)
         {
             InitCountingSumScorer();
         }
         while (countingSumScorer.Next())
         {
             hc.Collect(countingSumScorer.Doc(), Score());
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>Scores and collects all matching documents.</summary>
 /// <param name="hc">The collector to which all matching documents are passed through
 /// {@link HitCollector#Collect(int, float)}.
 /// <br>When this method is used the {@link #Explain(int)} method should not be used.
 /// </param>
 public virtual void Score(HitCollector hc)
 {
     while (Next())
     {
         hc.Collect(Doc(), Score());
     }
 }
 /// <summary>Scores and collects all matching documents.</summary>
 /// <param name="hc">The collector to which all matching documents are passed through
 /// {@link HitCollector#Collect(int, float)}.
 /// <br>When this method is used the {@link #Explain(int)} method should not be used.
 /// </param>
 public override void  Score(HitCollector hc)
 {
     while (Next())
     {
         hc.Collect(currentDoc, currentScore);
     }
 }
Exemplo n.º 6
0
 /// <summary> Create a TimeLimitedCollector wrapper over another HitCollector with a specified timeout.</summary>
 /// <param name="hc">the wrapped HitCollector
 /// </param>
 /// <param name="timeAllowed">max time allowed for collecting hits after which {@link TimeExceededException} is thrown
 /// </param>
 public TimeLimitedCollector(HitCollector hc, long timeAllowed)
 {
     InitBlock();
     this.hc      = hc;
     t0           = TIMER_THREAD.GetMilliseconds();
     this.timeout = t0 + timeAllowed;
 }
Exemplo n.º 7
0
		protected internal override bool Score(HitCollector c, int end)
		{
			Similarity similarity = GetSimilarity(); // cache sim in local
			float[] normDecoder = Similarity.GetNormDecoder();
			while (doc < end)
			{
				// for docs in window
				int f = freqs[pointer];
				float score = f < SCORE_CACHE_SIZE ? scoreCache[f] : similarity.Tf(f) * weightValue; // cache miss
				
				score *= normDecoder[norms[doc] & 0xFF]; // normalize for field
				
				c.Collect(doc, score); // collect score
				
				if (++pointer >= pointerMax)
				{
					pointerMax = termDocs.Read(docs, freqs); // refill buffers
					if (pointerMax != 0)
					{
						pointer = 0;
					}
					else
					{
						termDocs.Close(); // close stream
						doc = System.Int32.MaxValue; // set to sentinel value
						return false;
					}
				}
				doc = docs[pointer];
			}
			return true;
		}
Exemplo n.º 8
0
 /// <summary>Scores and collects all matching documents.</summary>
 /// <param name="hc">The collector to which all matching documents are passed through
 /// {@link HitCollector#Collect(int, float)}.
 /// <br>When this method is used the {@link #Explain(int)} method should not be used.
 /// </param>
 public virtual void  Score(HitCollector hc)
 {
     while (Next())
     {
         hc.Collect(Doc(), Score());
     }
 }
Exemplo n.º 9
0
 public SubScorer(Scorer scorer, bool required, bool prohibited, HitCollector collector, SubScorer next)
 {
     this.scorer     = scorer;
     this.done       = !scorer.Next();
     this.required   = required;
     this.prohibited = prohibited;
     this.collector  = collector;
     this.next       = next;
 }
Exemplo n.º 10
0
        // inherit javadoc
        public override void  Search(Weight weight, Filter filter, HitCollector results)
        {
            for (int i = 0; i < searchables.Length; i++)
            {
                int start = starts[i];

                searchables[i].Search(weight, filter, new AnonymousClassHitCollector(results, start, this));
            }
        }
Exemplo n.º 11
0
			public SubScorer(Scorer scorer, bool required, bool prohibited, HitCollector collector, SubScorer next)
			{
				this.scorer = scorer;
				this.done = !scorer.Next();
				this.required = required;
				this.prohibited = prohibited;
				this.collector = collector;
				this.next = next;
			}
Exemplo n.º 12
0
		/// <summary>Expert: Collects matching documents in a range.  Hook for optimization.
		/// Note that {@link #Next()} must be called once before this method is called
		/// for the first time.
		/// </summary>
		/// <param name="hc">The collector to which all matching documents are passed through
		/// {@link HitCollector#Collect(int, float)}.
		/// </param>
		/// <param name="max">Do not score documents past this.
		/// </param>
		/// <returns> true if more matching documents may remain.
		/// </returns>
		protected internal virtual bool Score(HitCollector hc, int max)
		{
			while (Doc() < max)
			{
				hc.Collect(Doc(), Score());
				if (!Next())
					return false;
			}
			return true;
		}
Exemplo n.º 13
0
 /// <summary>Scores and collects all matching documents.</summary>
 /// <param name="hc">The collector to which all matching documents are passed through
 /// {@link HitCollector#Collect(int, float)}.
 /// <br>When this method is used the {@link #Explain(int)} method should not be used.
 /// </param>
 public override void  Score(HitCollector hc)
 {
     if (countingSumScorer == null)
     {
         InitCountingSumScorer();
     }
     while (countingSumScorer.Next())
     {
         hc.Collect(countingSumScorer.Doc(), Score());
     }
 }
Exemplo n.º 14
0
 /// <summary>Expert: Collects matching documents in a range.  Hook for optimization.
 /// Note that {@link #Next()} must be called once before this method is called
 /// for the first time.
 /// </summary>
 /// <param name="hc">The collector to which all matching documents are passed through
 /// {@link HitCollector#Collect(int, float)}.
 /// </param>
 /// <param name="max">Do not score documents past this.
 /// </param>
 /// <returns> true if more matching documents may remain.
 /// </returns>
 protected internal virtual bool Score(HitCollector hc, int max)
 {
     while (Doc() < max)
     {
         hc.Collect(Doc(), Score());
         if (!Next())
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 15
0
 /// <summary>Expert: Collects matching documents in a range.  Hook for optimization.
 /// Note that {@link #Next()} must be called once before this method is called
 /// for the first time.
 /// </summary>
 /// <param name="hc">The collector to which all matching documents are passed through
 /// {@link HitCollector#Collect(int, float)}.
 /// </param>
 /// <param name="max">Do not score documents past this.
 /// </param>
 /// <returns> true if more matching documents may remain.
 /// </returns>
 protected internal override bool Score(HitCollector hc, int max)
 {
     while (currentDoc < max)
     {
         hc.Collect(currentDoc, currentScore);
         if (!Next())
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 16
0
        private void  DoTestTimeout(bool multiThreaded, bool greedy)
        {
            // setup
            MyHitCollector myHc = new MyHitCollector(this);

            myHc.SetSlowDown(SLOW_DOWN);
            HitCollector tlCollector = CreateTimedCollector(myHc, TIME_ALLOWED, greedy);

            // search
            TimeLimitedCollector.TimeExceededException timoutException = null;
            try
            {
                Search(tlCollector);
            }
            catch (TimeLimitedCollector.TimeExceededException x)
            {
                timoutException = x;
            }
            catch (System.Exception e)
            {
                Assert.IsTrue(false, "Unexpected exception: " + e);                 //==fail
            }

            // must get exception
            Assert.IsNotNull(timoutException, "Timeout expected!");

            // greediness affect last doc collected
            int exceptionDoc  = timoutException.GetLastDocCollected();
            int lastCollected = myHc.GetLastDocCollected();

            Assert.IsTrue(exceptionDoc > 0, "doc collected at timeout must be > 0!");
            if (greedy)
            {
                Assert.IsTrue(exceptionDoc == lastCollected, "greedy=" + greedy + " exceptionDoc=" + exceptionDoc + " != lastCollected=" + lastCollected);
                Assert.IsTrue(myHc.HitCount() > 0, "greedy, but no hits found!");
            }
            else
            {
                Assert.IsTrue(exceptionDoc > lastCollected, "greedy=" + greedy + " exceptionDoc=" + exceptionDoc + " not > lastCollected=" + lastCollected);
            }

            // verify that elapsed time at exception is within valid limits
            Assert.AreEqual(timoutException.GetTimeAllowed(), TIME_ALLOWED);
            // a) Not too early
            Assert.IsTrue(timoutException.GetTimeElapsed() > TIME_ALLOWED - TimeLimitedCollector.GetResolution(), "elapsed=" + timoutException.GetTimeElapsed() + " <= (allowed-resolution)=" + (TIME_ALLOWED - TimeLimitedCollector.GetResolution()));
            // b) Not too late.
            //    This part is problematic in a busy test system, so we just print a warning.
            //    We already verified that a timeout occurred, we just can't be picky about how long it took.
            if (timoutException.GetTimeElapsed() > MaxTime(multiThreaded))
            {
                System.Console.Out.WriteLine("Informative: timeout exceeded (no action required: most probably just " + " because the test machine is slower than usual):  " + "lastDoc=" + exceptionDoc + " ,&& allowed=" + timoutException.GetTimeAllowed() + " ,&& elapsed=" + timoutException.GetTimeElapsed() + " >= " + MaxTimeStr(multiThreaded));
            }
        }
Exemplo n.º 17
0
        /// <summary>Expert: Collects matching documents in a range.
        /// <br>Note that {@link #Next()} must be called once before this method is
        /// called for the first time.
        /// </summary>
        /// <param name="hc">The collector to which all matching documents are passed through
        /// {@link HitCollector#Collect(int, float)}.
        /// </param>
        /// <param name="max">Do not score documents past this.
        /// </param>
        /// <returns> true if more matching documents may remain.
        /// </returns>
        protected internal override bool Score(HitCollector hc, int max)
        {
            // null pointer exception when Next() was not called before:
            int docNr = countingSumScorer.Doc();

            while (docNr < max)
            {
                hc.Collect(docNr, Score());
                if (!countingSumScorer.Next())
                {
                    return(false);
                }
                docNr = countingSumScorer.Doc();
            }
            return(true);
        }
Exemplo n.º 18
0
        // inherit javadoc
        public override void  Search(Weight weight, Filter filter, HitCollector results)
        {
            HitCollector collector = results;

            if (filter != null)
            {
                System.Collections.BitArray bits = filter.Bits(reader);
                collector = new AnonymousClassHitCollector(bits, results, this);
            }

            Scorer scorer = weight.Scorer(reader);

            if (scorer == null)
            {
                return;
            }
            scorer.Score(collector);
        }
Exemplo n.º 19
0
        // inherit javadoc
        public override void  Search(Weight weight, Filter filter, HitCollector results)
        {
            Scorer scorer = weight.Scorer(reader);

            if (scorer == null)
            {
                return;
            }

            if (filter == null)
            {
                scorer.Score(results);
                return;
            }

            DocIdSetIterator filterDocIdIterator = filter.GetDocIdSet(reader).Iterator(); // CHECKME: use ConjunctionScorer here?

            bool more = filterDocIdIterator.Next() && scorer.SkipTo(filterDocIdIterator.Doc());

            while (more)
            {
                int filterDocId = filterDocIdIterator.Doc();
                if (filterDocId > scorer.Doc() && !scorer.SkipTo(filterDocId))
                {
                    more = false;
                }
                else
                {
                    int scorerDocId = scorer.Doc();
                    if (scorerDocId == filterDocId) // permitted by filter
                    {
                        results.Collect(scorerDocId, scorer.Score());
                        more = filterDocIdIterator.Next();
                    }
                    else
                    {
                        more = filterDocIdIterator.SkipTo(scorerDocId);
                    }
                }
            }
        }
Exemplo n.º 20
0
        private void  DoTestSearch()
        {
            int totalResults    = 0;
            int totalTLCResults = 0;

            try
            {
                MyHitCollector myHc = new MyHitCollector(this);
                Search(myHc);
                totalResults = myHc.HitCount();

                myHc = new MyHitCollector(this);
                long         oneHour     = 3600000;
                HitCollector tlCollector = CreateTimedCollector(myHc, oneHour, false);
                Search(tlCollector);
                totalTLCResults = myHc.HitCount();
            }
            catch (System.Exception e)
            {
                System.Console.Error.WriteLine(e.StackTrace);
                Assert.IsTrue(false, "Unexpected exception: " + e);                 //==fail
            }
            Assert.AreEqual(totalResults, totalTLCResults, "Wrong number of results!");
        }
Exemplo n.º 21
0
 protected internal override bool Score(HitCollector c, int end)
 {
     return(Score(new HitCollectorWrapper(c), end, doc));
 }
Exemplo n.º 22
0
		public override void  Score(HitCollector hc)
		{
			Score(new HitCollectorWrapper(hc));
		}
 /// <summary>Scores and collects all matching documents.</summary>
 /// <param name="hc">The collector to which all matching documents are passed through
 /// {@link HitCollector#Collect(int, float)}.
 /// <br>When this method is used the {@link #Explain(int)} method should not be used.
 /// </param>
 public override void Score(HitCollector hc)
 {
     if (countingSumScorer == null)
     {
         InitCountingSumScorer();
     }
     while (countingSumScorer.Next())
     {
         hc.Collect(countingSumScorer.Doc(), Score());
     }
 }
Exemplo n.º 24
0
		public virtual void  Search(Weight weight, Filter filter, HitCollector results)
		{
			Search(weight, filter, new HitCollectorWrapper(results));
		}
Exemplo n.º 25
0
 public override void  Search(Query query, Filter filter, HitCollector results)
 {
     Search(query, filter, new HitCollectorWrapper(results));
 }
Exemplo n.º 26
0
 public virtual void  Search(Weight weight, Filter filter, HitCollector results)
 {
     Search(weight, filter, new HitCollectorWrapper(results));
 }
Exemplo n.º 27
0
 public virtual void  Search(Query query, HitCollector results)
 {
     Search(CreateWeight(query), null, new HitCollectorWrapper(results));
 }
Exemplo n.º 28
0
		/// <summary>Scores and collects all matching documents.</summary>
		/// <param name="hc">The collector to which all matching documents are passed through
		/// {@link HitCollector#Collect(int, float)}.
		/// <br>When this method is used the {@link #Explain(int)} method should not be used.
		/// </param>
		public override void  Score(HitCollector hc)
		{
			if (allowDocsOutOfOrder && requiredScorers.Count == 0 && prohibitedScorers.Count < 32)
			{
				// fall back to BooleanScorer, scores documents somewhat out of order
				BooleanScorer bs = new BooleanScorer(GetSimilarity(), minNrShouldMatch);
				System.Collections.IEnumerator si = optionalScorers.GetEnumerator();
				while (si.MoveNext())
				{
					bs.Add((Scorer) si.Current, false, false);
				}
				si = prohibitedScorers.GetEnumerator();
				while (si.MoveNext())
				{
					bs.Add((Scorer) si.Current, false, true);
				}
				bs.Score(hc);
			}
			else
			{
				if (countingSumScorer == null)
				{
					InitCountingSumScorer();
				}
				while (countingSumScorer.Next())
				{
					hc.Collect(countingSumScorer.Doc(), Score());
				}
			}
		}
Exemplo n.º 29
0
		protected internal override bool Score(HitCollector hc, int max)
		{
			if (coordFactors == null)
				ComputeCoordFactors();
			
			bool more;
			Bucket tmp;
			
			do 
			{
				bucketTable.first = null;
				
				while (current != null)
				{
					// more queued 
					
					// check prohibited & required
					if ((current.bits & prohibitedMask) == 0 && (current.bits & requiredMask) == requiredMask)
					{
						
						if (current.doc >= max)
						{
							tmp = current;
							current = current.next;
							tmp.next = bucketTable.first;
							bucketTable.first = tmp;
							continue;
						}
						
						hc.Collect(current.doc, current.score * coordFactors[current.coord]);
					}
					
					current = current.next; // pop the queue
				}
				
				if (bucketTable.first != null)
				{
					current = bucketTable.first;
					bucketTable.first = current.next;
					return true;
				}
				
				// refill the queue
				more = false;
				end += BucketTable.SIZE;
				for (SubScorer sub = scorers; sub != null; sub = sub.next)
				{
					if (!sub.done)
					{
						sub.done = !sub.scorer.Score(sub.collector, end);
						if (!sub.done)
							more = true;
					}
				}
				current = bucketTable.first;
			}
			while (current != null || more);
			
			return false;
		}
Exemplo n.º 30
0
        // inherit javadoc
        public override void Search(Weight weight, Filter filter, HitCollector results)
        {
            Scorer scorer = weight.Scorer(reader);
            if (scorer == null)
                return;

            if (filter == null)
            {
                scorer.Score(results);
                return;
            }

            DocIdSetIterator filterDocIdIterator = filter.GetDocIdSet(reader).Iterator(); // CHECKME: use ConjunctionScorer here?

            bool more = filterDocIdIterator.Next() && scorer.SkipTo(filterDocIdIterator.Doc());

            while (more)
            {
                int filterDocId = filterDocIdIterator.Doc();
                if (filterDocId > scorer.Doc() && !scorer.SkipTo(filterDocId))
                {
                    more = false;
                }
                else
                {
                    int scorerDocId = scorer.Doc();
                    if (scorerDocId == filterDocId) // permitted by filter
                    {
                        results.Collect(scorerDocId, scorer.Score());
                        more = filterDocIdIterator.Next();
                    }
                    else
                    {
                        more = filterDocIdIterator.SkipTo(scorerDocId);
                    }
                }
            }
        }
Exemplo n.º 31
0
		public HitCollectorWrapper(HitCollector collector)
		{
			this.collector = collector;
		}
Exemplo n.º 32
0
 public override void  Search(Weight weight, Filter filter, HitCollector results)
 {
     throw new System.NotSupportedException();
 }
Exemplo n.º 33
0
			public override void  Search(Query query, Filter filter, HitCollector results)
			{
				Search(query, filter, new HitCollectorWrapper(results));
			}
Exemplo n.º 34
0
		// this implementation should be removed when the deprecated
		// Searchable#search(Query,Filter,HitCollector) is removed
		public virtual void  Search(Query query, Filter filter, HitCollector results)
		{
			local.Search(query, filter, results);
		}
Exemplo n.º 35
0
		public virtual void  Search(Query query, HitCollector results)
		{
			Search(CreateWeight(query), null, new HitCollectorWrapper(results));
		}
Exemplo n.º 36
0
		private void  Search(HitCollector collector)
		{
			searcher.Search(query, collector);
		}
Exemplo n.º 37
0
 /// <summary>Lower-level search API.
 ///
 /// <p>{@link HitCollector#Collect(int,float)} is called for every non-zero
 /// scoring document.
 /// <br>HitCollector-based access to remote indexes is discouraged.
 ///
 /// <p>Applications should only use this if they need <i>all</i> of the
 /// matching documents.  The high-level search API ({@link
 /// Searcher#Search(Query)}) is usually more efficient, as it skips
 /// non-high-scoring hits.
 ///
 /// </summary>
 /// <param name="query">to match documents
 /// </param>
 /// <param name="filter">if non-null, a bitset used to eliminate some documents
 /// </param>
 /// <param name="results">to receive hits
 /// </param>
 /// <throws>  BooleanQuery.TooManyClauses </throws>
 public virtual void  Search(Query query, Filter filter, HitCollector results)
 {
     Search(CreateWeight(query), filter, results);
 }
Exemplo n.º 38
0
		protected internal virtual bool Score(HitCollector hc, int max)
		{
			return Score(new HitCollectorWrapper(hc), max, DocID());
		}
 /// <summary>Expert: Collects matching documents in a range.
 /// <br>Note that {@link #Next()} must be called once before this method is
 /// called for the first time.
 /// </summary>
 /// <param name="hc">The collector to which all matching documents are passed through
 /// {@link HitCollector#Collect(int, float)}.
 /// </param>
 /// <param name="max">Do not score documents past this.
 /// </param>
 /// <returns> true if more matching documents may remain.
 /// </returns>
 protected internal override bool Score(HitCollector hc, int max)
 {
     // null pointer exception when Next() was not called before:
     int docNr = countingSumScorer.Doc();
     while (docNr < max)
     {
         hc.Collect(docNr, Score());
         if (!countingSumScorer.Next())
         {
             return false;
         }
         docNr = countingSumScorer.Doc();
     }
     return true;
 }
Exemplo n.º 40
0
 public virtual void  Score(HitCollector hc)
 {
     Score(new HitCollectorWrapper(hc));
 }
Exemplo n.º 41
0
 public override void Score(HitCollector hc)
 {
     Next();
     Score(hc, System.Int32.MaxValue);
 }
Exemplo n.º 42
0
			public override void  Search(Query query, Filter filter, HitCollector results)
			{
				CheckExplanations(query);
				base.Search(query, filter, results);
			}
Exemplo n.º 43
0
 /// <summary>Lower-level search API.
 ///
 /// <p>{@link HitCollector#Collect(int,float)} is called for every non-zero
 /// scoring document.
 ///
 /// <p>Applications should only use this if they need <i>all</i> of the
 /// matching documents.  The high-level search API ({@link
 /// Searcher#Search(Query)}) is usually more efficient, as it skips
 /// non-high-scoring hits.
 /// <p>Note: The <code>score</code> passed to this method is a raw score.
 /// In other words, the score will not necessarily be a float whose value is
 /// between 0 and 1.
 /// </summary>
 /// <throws>  BooleanQuery.TooManyClauses </throws>
 public virtual void  Search(Query query, HitCollector results)
 {
     Search(query, (Filter)null, results);
 }
Exemplo n.º 44
0
        protected internal override bool Score(HitCollector hc, int max)
        {
            if (coordFactors == null)
            {
                ComputeCoordFactors();
            }

            bool   more;
            Bucket tmp;

            do
            {
                bucketTable.first = null;

                while (current != null)
                {
                    // more queued

                    // check prohibited & required
                    if ((current.bits & prohibitedMask) == 0 && (current.bits & requiredMask) == requiredMask)
                    {
                        if (current.doc >= max)
                        {
                            tmp               = current;
                            current           = current.next;
                            tmp.next          = bucketTable.first;
                            bucketTable.first = tmp;
                            continue;
                        }

                        hc.Collect(current.doc, current.score * coordFactors[current.coord]);
                    }

                    current = current.next;                     // pop the queue
                }

                if (bucketTable.first != null)
                {
                    current           = bucketTable.first;
                    bucketTable.first = current.next;
                    return(true);
                }

                // refill the queue
                more = false;
                end += BucketTable.SIZE;
                for (SubScorer sub = scorers; sub != null; sub = sub.next)
                {
                    if (!sub.done)
                    {
                        sub.done = !sub.scorer.Score(sub.collector, end);
                        if (!sub.done)
                        {
                            more = true;
                        }
                    }
                }
                current = bucketTable.first;
            }while (current != null || more);

            return(false);
        }
Exemplo n.º 45
0
 /* The following abstract methods were added as a workaround for GCJ bug #15411.
  * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15411
  */
 abstract public void  Search(Weight weight, Filter filter, HitCollector results);
Exemplo n.º 46
0
 public virtual void Search(Weight weight, Filter filter, HitCollector results)
 {
     local.Search(weight, filter, results);
 }
Exemplo n.º 47
0
		public virtual void  Score(HitCollector hc)
		{
			Score(new HitCollectorWrapper(hc));
		}
Exemplo n.º 48
0
		/// <summary>Lower-level search API.
		/// 
		/// <p>{@link HitCollector#Collect(int,float)} is called for every non-zero
		/// scoring document.
		/// <br>HitCollector-based access to remote indexes is discouraged.
		/// 
		/// <p>Applications should only use this if they need <i>all</i> of the
		/// matching documents.  The high-level search API ({@link
		/// Searcher#Search(Query)}) is usually more efficient, as it skips
		/// non-high-scoring hits.
		/// 
		/// </summary>
		/// <param name="query">to match documents
		/// </param>
		/// <param name="filter">if non-null, a bitset used to eliminate some documents
		/// </param>
		/// <param name="results">to receive hits
		/// </param>
		/// <throws>  BooleanQuery.TooManyClauses </throws>
		public virtual void  Search(Query query, Filter filter, HitCollector results)
		{
			Search(CreateWeight(query), filter, results);
		}
Exemplo n.º 49
0
        // inherit javadoc
        public override void Search(Weight weight, Filter filter, HitCollector results)
        {
            HitCollector collector = results;
            if (filter != null)
            {
                System.Collections.BitArray bits = filter.Bits(reader);
                collector = new AnonymousClassHitCollector(bits, results, this);
            }

            Scorer scorer = weight.Scorer(reader);
            if (scorer == null)
                return ;
            scorer.Score(collector);
        }
Exemplo n.º 50
0
 protected internal override bool Score(HitCollector hc, int max)
 {
     return(Score(new HitCollectorWrapper(hc), max, DocID()));
 }
Exemplo n.º 51
0
 public override void  Score(HitCollector hc)
 {
     Next();
     Score(hc, System.Int32.MaxValue);
 }
Exemplo n.º 52
0
		protected internal override bool Score(HitCollector c, int end)
		{
			return Score(new HitCollectorWrapper(c), end, doc);
		}
Exemplo n.º 53
0
			public override void  Search(Weight weight, Filter filter, HitCollector results)
			{
				throw new System.NotSupportedException();
			}
Exemplo n.º 54
0
		// inherit javadoc
		public override void  Search(Weight weight, Filter filter, HitCollector results)
		{
			for (int i = 0; i < searchables.Length; i++)
			{
				
				int start = starts[i];
				
				searchables[i].Search(weight, filter, new AnonymousClassHitCollector(results, start, this));
			}
		}
Exemplo n.º 55
0
		/// <summary>Lower-level search API.
		/// 
		/// <p>{@link HitCollector#Collect(int,float)} is called for every non-zero
		/// scoring document.
		/// 
		/// <p>Applications should only use this if they need <i>all</i> of the
		/// matching documents.  The high-level search API ({@link
		/// Searcher#Search(Query)}) is usually more efficient, as it skips
		/// non-high-scoring hits.
		/// <p>Note: The <code>score</code> passed to this method is a raw score.
		/// In other words, the score will not necessarily be a float whose value is
		/// between 0 and 1.
		/// </summary>
		/// <throws>  BooleanQuery.TooManyClauses </throws>
		public virtual void  Search(Query query, HitCollector results)
		{
			Search(query, (Filter) null, results);
		}
Exemplo n.º 56
0
 // this implementation should be removed when the deprecated
 // Searchable#search(Query,Filter,HitCollector) is removed
 public virtual void  Search(Query query, Filter filter, HitCollector results)
 {
     local.Search(query, filter, results);
 }
Exemplo n.º 57
0
		/* The following abstract methods were added as a workaround for GCJ bug #15411.
		* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15411
		*/
		abstract public void  Search(Weight weight, Filter filter, HitCollector results);
Exemplo n.º 58
0
 public virtual void  Search(Weight weight, Filter filter, HitCollector results)
 {
     local.Search(weight, filter, results);
 }
Exemplo n.º 59
0
 public override void  Score(HitCollector hc)
 {
     Score(new HitCollectorWrapper(hc));
 }
		/// <summary>Expert: Collects matching documents in a range.  Hook for optimization.
		/// Note that {@link #Next()} must be called once before this method is called
		/// for the first time.
		/// </summary>
		/// <param name="hc">The collector to which all matching documents are passed through
		/// {@link HitCollector#Collect(int, float)}.
		/// </param>
		/// <param name="max">Do not score documents past this.
		/// </param>
		/// <returns> true if more matching documents may remain.
		/// </returns>
		protected internal override bool Score(HitCollector hc, int max)
		{
			while (currentDoc < max)
			{
				hc.Collect(currentDoc, currentScore);
				if (!Next())
				{
					return false;
				}
			}
			return true;
		}