You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by eh...@apache.org on 2017/04/30 03:15:31 UTC

lucene-solr:jira/SOLR-1485: Fix .equals/hashCode nocommits

Repository: lucene-solr
Updated Branches:
  refs/heads/jira/SOLR-1485 04e760463 -> ee1ece0fa


Fix .equals/hashCode nocommits


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ee1ece0f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ee1ece0f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ee1ece0f

Branch: refs/heads/jira/SOLR-1485
Commit: ee1ece0fa4e6829c8d17359ca3dbf6768589a098
Parents: 04e7604
Author: Erik Hatcher <eh...@apache.org>
Authored: Sat Apr 29 23:15:20 2017 -0400
Committer: Erik Hatcher <eh...@apache.org>
Committed: Sat Apr 29 23:15:20 2017 -0400

----------------------------------------------------------------------
 .../solr/search/FloatPayloadValueSource.java    | 24 ++++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ee1ece0f/solr/core/src/java/org/apache/solr/search/FloatPayloadValueSource.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/FloatPayloadValueSource.java b/solr/core/src/java/org/apache/solr/search/FloatPayloadValueSource.java
index 0862e78..e926ef8 100644
--- a/solr/core/src/java/org/apache/solr/search/FloatPayloadValueSource.java
+++ b/solr/core/src/java/org/apache/solr/search/FloatPayloadValueSource.java
@@ -20,7 +20,6 @@ package org.apache.solr.search;
 import java.io.IOException;
 import java.util.Map;
 
-import org.apache.lucene.analysis.payloads.PayloadHelper;
 import org.apache.lucene.index.Fields;
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.PostingsEnum;
@@ -29,7 +28,6 @@ import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.queries.function.FunctionValues;
 import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queries.function.docvalues.FloatDocValues;
-import org.apache.lucene.queries.payloads.MaxPayloadFunction;
 import org.apache.lucene.queries.payloads.PayloadFunction;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.util.BytesRef;
@@ -195,27 +193,29 @@ public class FloatPayloadValueSource extends ValueSource {
     return name() + '(' + field + ',' + val + ',' + defaultValueSource.toString() + ')';
   }
 
-
-  // TODO: fix up equals and hashCode
-
-
   @Override
-  public boolean equals(Object o) { // nocommit: needs update?
+  public boolean equals(Object o) {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
 
     FloatPayloadValueSource that = (FloatPayloadValueSource) o;
 
-    if (indexedField != null ? !indexedField.equals(that.indexedField) : that.indexedField != null) return false;
-    return indexedBytes != null ? indexedBytes.equals(that.indexedBytes) : that.indexedBytes == null;
+    if (!indexedField.equals(that.indexedField)) return false;
+    if (indexedBytes != null ? !indexedBytes.equals(that.indexedBytes) : that.indexedBytes != null) return false;
+    if (!decoder.equals(that.decoder)) return false;
+    if (payloadFunction != null ? !payloadFunction.equals(that.payloadFunction) : that.payloadFunction != null)
+      return false;
+    return defaultValueSource.equals(that.defaultValueSource);
 
   }
 
   @Override
-  public int hashCode() {   // nocommit: needs update?
-    int result = indexedField != null ? indexedField.hashCode() : 0;
+  public int hashCode() {
+    int result = indexedField.hashCode();
     result = 31 * result + (indexedBytes != null ? indexedBytes.hashCode() : 0);
+    result = 31 * result + decoder.hashCode();
+    result = 31 * result + (payloadFunction != null ? payloadFunction.hashCode() : 0);
+    result = 31 * result + defaultValueSource.hashCode();
     return result;
   }
-
 }