本文整理汇总了C#中Lucene.Net.Search.WildcardQuery.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# WildcardQuery.Equals方法的具体用法?C# WildcardQuery.Equals怎么用?C# WildcardQuery.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Search.WildcardQuery
的用法示例。
在下文中一共展示了WildcardQuery.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEquals
public virtual void TestEquals()
{
WildcardQuery wq1 = new WildcardQuery(new Term("field", "b*a"));
WildcardQuery wq2 = new WildcardQuery(new Term("field", "b*a"));
WildcardQuery wq3 = new WildcardQuery(new Term("field", "b*a"));
// reflexive?
Assert.AreEqual(wq1, wq2);
Assert.AreEqual(wq2, wq1);
// transitive?
Assert.AreEqual(wq2, wq3);
Assert.AreEqual(wq1, wq3);
Assert.IsFalse(wq1.Equals(null));
FuzzyQuery fq = new FuzzyQuery(new Term("field", "b*a"));
Assert.IsFalse(wq1.Equals(fq));
Assert.IsFalse(fq.Equals(wq1));
}
示例2: TestEquals
public virtual void TestEquals()
{
AutomatonQuery a1 = new AutomatonQuery(NewTerm("foobar"), BasicAutomata.MakeString("foobar"));
// reference to a1
AutomatonQuery a2 = a1;
// same as a1 (accepts the same language, same term)
AutomatonQuery a3 = new AutomatonQuery(NewTerm("foobar"), BasicOperations.Concatenate(BasicAutomata.MakeString("foo"), BasicAutomata.MakeString("bar")));
// different than a1 (same term, but different language)
AutomatonQuery a4 = new AutomatonQuery(NewTerm("foobar"), BasicAutomata.MakeString("different"));
// different than a1 (different term, same language)
AutomatonQuery a5 = new AutomatonQuery(NewTerm("blah"), BasicAutomata.MakeString("foobar"));
Assert.AreEqual(a1.GetHashCode(), a2.GetHashCode());
Assert.AreEqual(a1, a2);
Assert.AreEqual(a1.GetHashCode(), a3.GetHashCode());
Assert.AreEqual(a1, a3);
// different class
AutomatonQuery w1 = new WildcardQuery(NewTerm("foobar"));
// different class
AutomatonQuery w2 = new RegexpQuery(NewTerm("foobar"));
Assert.IsFalse(a1.Equals(w1));
Assert.IsFalse(a1.Equals(w2));
Assert.IsFalse(w1.Equals(w2));
Assert.IsFalse(a1.Equals(a4));
Assert.IsFalse(a1.Equals(a5));
Assert.IsFalse(a1.Equals(null));
}