本文整理汇总了C#中Lucene.Net.Search.TermRangeQuery.SetBoost方法的典型用法代码示例。如果您正苦于以下问题:C# TermRangeQuery.SetBoost方法的具体用法?C# TermRangeQuery.SetBoost怎么用?C# TermRangeQuery.SetBoost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Search.TermRangeQuery
的用法示例。
在下文中一共展示了TermRangeQuery.SetBoost方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEqualsHashcode
public virtual void TestEqualsHashcode()
{
Query query = new TermRangeQuery("content", "A", "C", true, true);
query.SetBoost(1.0f);
Query other = new TermRangeQuery("content", "A", "C", true, true);
other.SetBoost(1.0f);
Assert.AreEqual(query, query, "query equals itself is true");
Assert.AreEqual(query, other, "equivalent queries are equal");
Assert.AreEqual(query.GetHashCode(), other.GetHashCode(), "hashcode must return same value when equals is true");
other.SetBoost(2.0f);
Assert.IsFalse(query.Equals(other), "Different boost queries are not equal");
other = new TermRangeQuery("notcontent", "A", "C", true, true);
Assert.IsFalse(query.Equals(other), "Different fields are not equal");
other = new TermRangeQuery("content", "X", "C", true, true);
Assert.IsFalse(query.Equals(other), "Different lower terms are not equal");
other = new TermRangeQuery("content", "A", "Z", true, true);
Assert.IsFalse(query.Equals(other), "Different upper terms are not equal");
query = new TermRangeQuery("content", null, "C", true, true);
other = new TermRangeQuery("content", null, "C", true, true);
Assert.AreEqual(query, other, "equivalent queries with null lowerterms are equal()");
Assert.AreEqual(query.GetHashCode(), other.GetHashCode(), "hashcode must return same value when equals is true");
query = new TermRangeQuery("content", "C", null, true, true);
other = new TermRangeQuery("content", "C", null, true, true);
Assert.AreEqual(query, other, "equivalent queries with null upperterms are equal()");
Assert.AreEqual(query.GetHashCode(), other.GetHashCode(), "hashcode returns same value");
query = new TermRangeQuery("content", null, "C", true, true);
other = new TermRangeQuery("content", "C", null, true, true);
Assert.IsFalse(query.Equals(other), "queries with different upper and lower terms are not equal");
query = new TermRangeQuery("content", "A", "C", false, false);
other = new TermRangeQuery("content", "A", "C", true, true);
Assert.IsFalse(query.Equals(other), "queries with different inclusive are not equal");
query = new TermRangeQuery("content", "A", "C", false, false);
other = new TermRangeQuery("content", "A", "C", false, false, System.Globalization.CultureInfo.CurrentCulture.CompareInfo);
Assert.IsFalse(query.Equals(other), "a query with a collator is not equal to one without");
}