You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2021/06/22 02:53:29 UTC

[GitHub] [solr] dsmiley commented on a change in pull request #175: SOLR-15185: fix hashCode

dsmiley commented on a change in pull request #175:
URL: https://github.com/apache/solr/pull/175#discussion_r655838352



##########
File path: solr/core/src/java/org/apache/solr/search/HashQParserPlugin.java
##########
@@ -114,7 +116,12 @@ public LongValues getValues(LeafReaderContext ctx, DoubleValues scores) throws I
             @Override
             public long longValue() throws IOException {
               //TODO: maybe cache hashCode if same ord as prev doc to save lookupOrd?
-              return atDoc ? values.lookupOrd(values.ordValue()).hashCode() : 0;
+              return atDoc ? hashCode(values.lookupOrd(values.ordValue())) : 0;
+            }
+
+            private long hashCode(BytesRef bytesRef) {
+              // Use deterministic hashCode (seed is a constant).  BytesRef.hashCode() varies!
+              return StringHelper.murmurhash3_x86_32(bytesRef, 0);

Review comment:
       Thanks for looking!  While you didn't explicitly make a recommendation on what to do, I think you've convinced me that we should use "Hash" for consistency.  I'll update.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org