lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [10/12] lucenenet git commit: Lucene.Net.Join (TermsIncludingScoreQuery + ToChildBlockJoinQuery + ToParentBlockJoinQuery): reverted Equals() implementation to the same as Lucene
Date Thu, 26 Jan 2017 14:38:08 GMT
Lucene.Net.Join (TermsIncludingScoreQuery + ToChildBlockJoinQuery + ToParentBlockJoinQuery):
reverted Equals() implementation to the same as Lucene


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

Branch: refs/heads/api-work
Commit: 057b654ff8b7573935d6b22c514f8f55a64bf49e
Parents: 96a10db
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Jan 26 20:28:14 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Jan 26 20:28:14 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Join/TermsIncludingScoreQuery.cs | 20 +++++++++-------
 src/Lucene.Net.Join/ToChildBlockJoinQuery.cs    | 25 ++++++++++----------
 src/Lucene.Net.Join/ToParentBlockJoinQuery.cs   | 25 ++++++++++----------
 3 files changed, 36 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/057b654f/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs b/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
index aacc83b..e312dfd 100644
--- a/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
+++ b/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
@@ -81,19 +81,23 @@ namespace Lucene.Net.Join
             return this;
         }
 
-        // LUCENENET TODO: Possible BUG - this Equals implementation probably doesn't match
Java
-        protected bool Equals(TermsIncludingScoreQuery other)
-        {
-            return base.Equals(other) && string.Equals(_field, other._field) &&
-                   Equals(_unwrittenOriginalQuery, other._unwrittenOriginalQuery);
-        }
-
         public override bool Equals(object obj)
         {
             if (ReferenceEquals(null, obj)) return false;
             if (ReferenceEquals(this, obj)) return true;
+            if (!base.Equals(obj)) return false;
             if (obj.GetType() != GetType()) return false;
-            return Equals((TermsIncludingScoreQuery) obj);
+
+            var other = (TermsIncludingScoreQuery)obj;
+            if (!_field.Equals(other._field))
+            {
+                return false;
+            }
+            if (!_unwrittenOriginalQuery.Equals(other._unwrittenOriginalQuery))
+            {
+                return false;
+            }
+            return true;
         }
 
         public override int GetHashCode()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/057b654f/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs b/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs
index 0001184..b8d5041 100644
--- a/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs
+++ b/src/Lucene.Net.Join/ToChildBlockJoinQuery.cs
@@ -364,21 +364,20 @@ namespace Lucene.Net.Join
             return "ToChildBlockJoinQuery (" + _parentQuery + ")";
         }
 
-        // LUCENENET TODO: Possible BUG - This equals implementation probably doesn't match
Lucene
-        protected bool Equals(ToChildBlockJoinQuery other)
-        {
-            return base.Equals(other) && 
-                Equals(_origParentQuery, other._origParentQuery) && 
-                _doScores == other._doScores &&
-                Equals(_parentsFilter, other._parentsFilter);
-        }
-
         public override bool Equals(object obj)
         {
-            if (ReferenceEquals(null, obj)) return false;
-            if (ReferenceEquals(this, obj)) return true;
-            if (obj.GetType() != GetType()) return false;
-            return Equals((ToChildBlockJoinQuery) obj);
+            if (obj is ToChildBlockJoinQuery)
+            {
+                ToChildBlockJoinQuery other = (ToChildBlockJoinQuery)obj;
+                return _origParentQuery.Equals(other._origParentQuery) &&
+                    _parentsFilter.Equals(other._parentsFilter) &&
+                    _doScores == other._doScores &&
+                    base.Equals(other);
+            }
+            else
+            {
+                return false;
+            }
         }
 
         public override int GetHashCode()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/057b654f/src/Lucene.Net.Join/ToParentBlockJoinQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Join/ToParentBlockJoinQuery.cs b/src/Lucene.Net.Join/ToParentBlockJoinQuery.cs
index c0f9ebe..6c9e011 100644
--- a/src/Lucene.Net.Join/ToParentBlockJoinQuery.cs
+++ b/src/Lucene.Net.Join/ToParentBlockJoinQuery.cs
@@ -486,21 +486,20 @@ namespace Lucene.Net.Join
             return "ToParentBlockJoinQuery (" + _childQuery + ")";
         }
 
-        // LUCENENET TODO: Possible BUG - this implemenation probably doesn't match Lucene
-        protected bool Equals(ToParentBlockJoinQuery other)
-        {
-            return base.Equals(other) && 
-                Equals(_parentsFilter, other._parentsFilter) && 
-                _scoreMode == other._scoreMode && 
-                Equals(_origChildQuery, other._origChildQuery);
-        }
-
         public override bool Equals(object obj)
         {
-            if (ReferenceEquals(null, obj)) return false;
-            if (ReferenceEquals(this, obj)) return true;
-            if (obj.GetType() != GetType()) return false;
-            return Equals((ToParentBlockJoinQuery) obj);
+            if (obj is ToParentBlockJoinQuery)
+            {
+                ToParentBlockJoinQuery other = (ToParentBlockJoinQuery)obj;
+                return _origChildQuery.Equals(other._origChildQuery) &&
+                    _parentsFilter.Equals(other._parentsFilter) &&
+                    _scoreMode == other._scoreMode &&
+                    base.Equals(other);
+            }
+            else
+            {
+                return false;
+            }
         }
 
         public override int GetHashCode()


Mime
View raw message