You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "jpountz (via GitHub)" <gi...@apache.org> on 2024/10/10 08:36:21 UTC

Re: [PR] Try using Murmurhash 3 for bloom filters [lucene]

jpountz commented on code in PR #12868:
URL: https://github.com/apache/lucene/pull/12868#discussion_r1794974762


##########
lucene/codecs/src/java/org/apache/lucene/codecs/bloom/FuzzySet.java:
##########
@@ -150,9 +149,10 @@ private FuzzySet(FixedBitSet filter, int bloomSize, int hashCount) {
    * @return NO or MAYBE
    */
   public ContainsResult contains(BytesRef value) {
-    long hash = hashFunction.hash(value);
-    int msb = (int) (hash >>> Integer.SIZE);
-    int lsb = (int) hash;
+    long[] hash = StringHelper.murmurhash3_x64_128(value);
+
+    int msb = (((int) hash[0] >>> Integer.SIZE) >>> 1) + (((int) hash[1] >>> Integer.SIZE) >>> 1);
+    int lsb = ((int) hash[0] >>> 1) + ((int) hash[1] >>> 1);

Review Comment:
   Can you make this simpler? E.g. `long msb = hash[0]; long lsb = hash[1];` and later `int bloomPos = ((int) (lsb + i * msb)) & bloomSize;`?



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

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


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