当前位置: 首页>>代码示例>>C#>>正文


C# Search.HitCollector类代码示例

本文整理汇总了C#中Lucene.Net.Search.HitCollector的典型用法代码示例。如果您正苦于以下问题:C# HitCollector类的具体用法?C# HitCollector怎么用?C# HitCollector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HitCollector类属于Lucene.Net.Search命名空间,在下文中一共展示了HitCollector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Score

		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;
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:32,代码来源:TermScorer.cs

示例2: TimeLimitedCollector

 /// <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;
 }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:12,代码来源:TimeLimitedCollector.cs

示例3: 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 virtual void Score(HitCollector hc)
 {
     while (Next())
     {
         hc.Collect(Doc(), Score());
     }
 }
开发者ID:karino2,项目名称:wikipediaconv,代码行数:12,代码来源:Scorer.cs

示例4: SubScorer

			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;
			}
开发者ID:zweib730,项目名称:beagrep,代码行数:9,代码来源:BooleanScorer.cs

示例5: Score

		/// <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;
		}
开发者ID:zweib730,项目名称:beagrep,代码行数:21,代码来源:Scorer.cs

示例6: Search

		public virtual void  Search(Query query, HitCollector results)
		{
			Search(CreateWeight(query), null, new HitCollectorWrapper(results));
		}
开发者ID:Mpdreamz,项目名称:lucene.net,代码行数:4,代码来源:Searcher.cs

示例7: HitCollectorWrapper

		public HitCollectorWrapper(HitCollector collector)
		{
			this.collector = collector;
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:4,代码来源:HitCollectorWrapper.cs

示例8: Search

        // 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);
                    }
                }
            }
        }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:39,代码来源:IndexSearcher.cs

示例9: Search

		/// <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);
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:23,代码来源:Searcher.cs

示例10: Search

 public virtual void Search(Weight weight, Filter filter, HitCollector results)
 {
     local.Search(weight, filter, results);
 }
开发者ID:karino2,项目名称:wikipediaconv,代码行数:4,代码来源:RemoteSearchable.cs

示例11: Score

		protected internal virtual bool Score(HitCollector hc, int max)
		{
			return Score(new HitCollectorWrapper(hc), max, DocID());
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:4,代码来源:Scorer.cs

示例12: Score

 public override void Score(HitCollector hc)
 {
     Next();
     Score(hc, System.Int32.MaxValue);
 }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:5,代码来源:TermScorer.cs

示例13: Score

 /// <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;
 }
开发者ID:vineelkovvuri,项目名称:ExtendableDesktopSearch,代码行数:26,代码来源:BooleanScorer2.cs

示例14: Score

		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;
		}
开发者ID:zweib730,项目名称:beagrep,代码行数:60,代码来源:BooleanScorer.cs

示例15: Search

			public override void  Search(Query query, Filter filter, HitCollector results)
			{
				CheckExplanations(query);
				base.Search(query, filter, results);
			}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:5,代码来源:CheckHits.cs


注:本文中的Lucene.Net.Search.HitCollector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。