Lucene.Net.Queries.Function.ValueSources.MultiBoolFunction: Use 
Equatable.Wrap() to wrap the provided list in EquatableList for Equals() and 
GetHashCode() comparisons


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/39333d07
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/39333d07
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/39333d07

Branch: refs/heads/api-work
Commit: 39333d070c5a8f9a8bd7776aafbe3a32a1726935
Parents: 1c751a2
Author: Shad Storhaug <[email protected]>
Authored: Thu Mar 30 08:40:55 2017 +0700
Committer: Shad Storhaug <[email protected]>
Committed: Thu Mar 30 09:12:51 2017 +0700

----------------------------------------------------------------------
 .../Function/ValueSources/MultiBoolFunction.cs            | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/39333d07/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs 
b/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
index ad1caec..48bf116 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Index;
 using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Search;
+using Lucene.Net.Support;
 using System.Collections;
 using System.Collections.Generic;
 using System.Text;
@@ -114,7 +115,9 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
         public override int GetHashCode()
         {
-            return m_sources.GetHashCode() + Name.GetHashCode();
+            // LUCENENET specific: ensure our passed in list is equatable by
+            // wrapping it in an EquatableList if it is not one already
+            return Equatable.Wrap(m_sources).GetHashCode() + 
Name.GetHashCode();
         }
 
         public override bool Equals(object o)
@@ -126,7 +129,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
             var other = o as MultiBoolFunction;
             if (other == null)
                 return false;
-            return this.m_sources.Equals(other.m_sources);
+
+            // LUCENENET specific: ensure our passed in list is equatable by
+            // wrapping it in an EquatableList if it is not one already
+            return Equatable.Wrap(this.m_sources).Equals(other.m_sources);
         }
 
         public override void CreateWeight(IDictionary context, IndexSearcher 
searcher)

Reply via email to