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


C# Searcher.Rewrite方法代码示例

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


在下文中一共展示了Searcher.Rewrite方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetHighlight

		public string GetHighlight(string value, string highlightField, Searcher searcher, string luceneRawQuery)
		{
			var query = GetQueryParser(highlightField).Parse(luceneRawQuery);
			var scorer = new QueryScorer(searcher.Rewrite(query));

			var highlighter = new Highlighter(HighlightFormatter, scorer);

			var tokenStream = HighlightAnalyzer.TokenStream(highlightField, new StringReader(value));
			string bestFragments = highlighter.GetBestFragments(tokenStream, value, MaxNumHighlights, Separator);
			return bestFragments;
		}
开发者ID:joosthollander,项目名称:Macaw.Umbraco.Foundation,代码行数:11,代码来源:LuceneHighlightHelper.cs

示例2: Weight

		/// <summary>Expert: Constructs and initializes a Weight for a top-level query. </summary>
		public virtual Weight Weight(Searcher searcher)
		{
			Query query = searcher.Rewrite(this);
			Weight weight = query.CreateWeight(searcher);
			float sum = weight.SumOfSquaredWeights();
			float norm = GetSimilarity(searcher).QueryNorm(sum);
			weight.Normalize(norm);
			return weight;
		}
开发者ID:zweib730,项目名称:beagrep,代码行数:10,代码来源:Query.cs

示例3: Weight

 /// <summary> Expert: Constructs and initializes a Weight for a top-level query.</summary>
 public virtual Weight Weight(Searcher searcher)
 {
     Query query = searcher.Rewrite(this);
     Weight weight = query.CreateWeight(searcher);
     float sum = weight.GetSumOfSquaredWeights();
     float norm = GetSimilarity(searcher).QueryNorm(sum);
     if (float.IsInfinity(norm) || float.IsNaN(norm))
         norm = 1.0f;
     weight.Normalize(norm);
     return weight;
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:12,代码来源:Query.cs

示例4: Check

 private static void  Check(Query q1, Searcher s, bool wrap)
 {
     try
     {
         Check(q1);
         if (s != null)
         {
             if (s is IndexSearcher)
             {
                 IndexSearcher is_Renamed = (IndexSearcher) s;
                 CheckFirstSkipTo(q1, is_Renamed);
                 CheckSkipTo(q1, is_Renamed);
                 if (wrap)
                 {
                     Check(q1, WrapUnderlyingReader(is_Renamed, - 1), false);
                     Check(q1, WrapUnderlyingReader(is_Renamed, 0), false);
                     Check(q1, WrapUnderlyingReader(is_Renamed, + 1), false);
                 }
             }
             if (wrap)
             {
                 Check(q1, WrapSearcher(s, - 1), false);
                 Check(q1, WrapSearcher(s, 0), false);
                 Check(q1, WrapSearcher(s, + 1), false);
             }
             CheckExplanations(q1, s);
             CheckSerialization(q1, s);
             
             Query q2 = (Query) q1.Clone();
             CheckEqual(s.Rewrite(q1), s.Rewrite(q2));
         }
     }
     catch (System.IO.IOException e)
     {
         throw new System.SystemException("", e);
     }
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:37,代码来源:QueryUtils.cs


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