Lucene.Net.Core.Search.Spans (SpanNearPayloadCheckQuery + SpanPayloadCheckQuery): Changed SequenceEqual() and GetValueHashCode() to Collections.Equals() and Collections.GetHashCode() (which both change their algorithm according to the type of collection that is used, just like in Lucene)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/476b2895 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/476b2895 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/476b2895 Branch: refs/heads/api-work Commit: 476b2895d9aba56703fd123c45d6d839bb65904d Parents: a4a5f1c Author: Shad Storhaug <[email protected]> Authored: Wed Mar 29 20:04:43 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Mar 30 09:12:28 2017 +0700 ---------------------------------------------------------------------- .../Search/Spans/SpanNearPayloadCheckQuery.cs | 8 +++++--- src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/476b2895/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 d46d737..a523fb6 100644 --- a/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs +++ b/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs @@ -118,8 +118,10 @@ namespace Lucene.Net.Search.Spans } SpanNearPayloadCheckQuery other = (SpanNearPayloadCheckQuery)o; - // 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; + // LUCENENET NOTE: Need to call Collections.Equals() to compare equality of all contained values + return Collections.Equals(this.m_payloadToMatch, other.m_payloadToMatch) + && this.m_match.Equals(other.m_match) + && this.Boost == other.Boost; } public override int GetHashCode() @@ -127,7 +129,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.GetValueHashCode(); // LUCENENET NOTE: Need to call GetValueHashCode() to combine the hash codes of all contained values + h ^= Collections.GetHashCode(m_payloadToMatch); // LUCENENET NOTE: Need to call Collections.GetHashCode() 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/476b2895/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 1564d25..466d894 100644 --- a/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs +++ b/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs @@ -118,8 +118,10 @@ namespace Lucene.Net.Search.Spans } SpanPayloadCheckQuery other = (SpanPayloadCheckQuery)o; - // 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; + // LUCENENET NOTE: Need to call Collections.Equals() to compare equality of all contained values + return Collections.Equals(this.m_payloadToMatch, other.m_payloadToMatch) + && this.m_match.Equals(other.m_match) + && this.Boost == other.Boost; } public override int GetHashCode() @@ -127,7 +129,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.GetValueHashCode(); // LUCENENET NOTE: Need to call GetValueHashCode() to combine the hash codes of all contained values + h ^= Collections.GetHashCode(m_payloadToMatch); // LUCENENET NOTE: Need to call Collections.GetHashCode() to combine the hash codes of all contained values h ^= Number.SingleToRawInt32Bits(Boost); return h; }
