Lucene.Net.Core.Search.Spans (SpanPayloadCheckQuery + SpanNearPayloadChecQuery): Changed GetHashCode() method to call m_payloadToMatch.GetValueHashCode() and Equals() method to call m_payloadToMatch so all contained values are included in the comparison.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/beab6980 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/beab6980 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/beab6980 Branch: refs/heads/api-work Commit: beab6980e06b519cfe54cbfb4647861dfd9730e2 Parents: dd574f7 Author: Shad Storhaug <[email protected]> Authored: Thu Mar 2 00:09:32 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Mar 2 08:08:50 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs | 6 ++++-- src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/beab6980/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs index 27af667..d46d737 100644 --- a/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs +++ b/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs @@ -1,5 +1,6 @@ using Lucene.Net.Support; using System.Collections.Generic; +using System.Linq; using System.Text; namespace Lucene.Net.Search.Spans @@ -117,7 +118,8 @@ namespace Lucene.Net.Search.Spans } SpanNearPayloadCheckQuery other = (SpanNearPayloadCheckQuery)o; - return this.m_payloadToMatch.Equals(other.m_payloadToMatch) && this.m_match.Equals(other.m_match) && this.Boost == other.Boost; + // LUCENENET NOTE: Need to call SequenceEqual() to compare equality of all contained values + return this.m_payloadToMatch.SequenceEqual(other.m_payloadToMatch) && this.m_match.Equals(other.m_match) && this.Boost == other.Boost; } public override int GetHashCode() @@ -125,7 +127,7 @@ namespace Lucene.Net.Search.Spans int h = m_match.GetHashCode(); h ^= (h << 8) | ((int)((uint)h >> 25)); // reversible //TODO: is this right? - h ^= m_payloadToMatch.GetHashCode(); + h ^= m_payloadToMatch.GetValueHashCode(); // LUCENENET NOTE: Need to call GetValueHashCode() to combine the hash codes of all contained values h ^= Number.SingleToRawInt32Bits(Boost); return h; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/beab6980/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs index 575f66f..1564d25 100644 --- a/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs +++ b/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs @@ -1,5 +1,6 @@ using Lucene.Net.Support; using System.Collections.Generic; +using System.Linq; using System.Text; namespace Lucene.Net.Search.Spans @@ -117,7 +118,8 @@ namespace Lucene.Net.Search.Spans } SpanPayloadCheckQuery other = (SpanPayloadCheckQuery)o; - return this.m_payloadToMatch.Equals(other.m_payloadToMatch) && this.m_match.Equals(other.m_match) && this.Boost == other.Boost; + // LUCENENET NOTE: Need to call SequenceEqual() to compare equality of all contained values + return this.m_payloadToMatch.SequenceEqual(other.m_payloadToMatch) && this.m_match.Equals(other.m_match) && this.Boost == other.Boost; } public override int GetHashCode() @@ -125,7 +127,7 @@ namespace Lucene.Net.Search.Spans int h = m_match.GetHashCode(); h ^= (h << 8) | ((int)((uint)h >> 25)); // reversible //TODO: is this right? - h ^= m_payloadToMatch.GetHashCode(); + h ^= m_payloadToMatch.GetValueHashCode(); // LUCENENET NOTE: Need to call GetValueHashCode() to combine the hash codes of all contained values h ^= Number.SingleToRawInt32Bits(Boost); return h; }
