本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
}