本文整理汇总了C#中Lucene.Net.Search.Query.GetBoost方法的典型用法代码示例。如果您正苦于以下问题:C# Query.GetBoost方法的具体用法?C# Query.GetBoost怎么用?C# Query.GetBoost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Search.Query
的用法示例。
在下文中一共展示了Query.GetBoost方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public void Add(Query query)
{
if (query is TermQuery)
{
AddTerm(((TermQuery)query).GetTerm(), query.GetBoost());
}
else if (query is PhraseQuery)
{
PhraseQuery pq = (PhraseQuery)query;
Term[] terms = pq.GetTerms();
HashMap<String, QueryPhraseMap> map = subMap;
QueryPhraseMap qpm = null;
foreach (Term term in terms)
{
qpm = GetOrNewMap(map, term.Text());
map = qpm.subMap;
}
qpm.MarkTerminal(pq.GetSlop(), pq.GetBoost());
}
else
throw new ApplicationException("query \"" + query.ToString() + "\" must be flatten first.");
}
示例2: CheckHashEquals
/// <summary>check very basic hashCode and equals </summary>
public static void CheckHashEquals(Query q)
{
Query q2 = (Query) q.Clone();
CheckEqual(q, q2);
Query q3 = (Query) q.Clone();
q3.SetBoost(7.21792348f);
CheckUnequal(q, q3);
// test that a class check is done so that no exception is thrown
// in the implementation of equals()
Query whacky = new AnonymousClassQuery();
whacky.SetBoost(q.GetBoost());
CheckUnequal(q, whacky);
}
示例3: BoostToString
private string BoostToString(Query query)
{
var sb = new StringBuilder();
var boost = query.GetBoost();
if (boost != 1.0)
sb.Append(", Boost(").Append(boost).Append(")");
return sb.ToString();
}