/** Calculates the hash code as required by TermsHash during indexing. * <p> This is currently implemented as MurmurHash3 (32 * bit), using the seed from {@link * StringHelper#GOOD_FAST_HASH_SEED}, but is subject to * change from release to release. */ @Override public int hashCode() { return StringHelper.murmurhash3_x86_32(this, StringHelper.GOOD_FAST_HASH_SEED); }
private int doHash(byte[] bytes, int offset, int length) { return StringHelper.murmurhash3_x86_32(bytes, offset, length, StringHelper.GOOD_FAST_HASH_SEED); }
public static int murmurhash3_x86_32(BytesRef bytes, int seed) { return murmurhash3_x86_32(bytes.bytes, bytes.offset, bytes.length, seed); }
public static int hash(byte[] bytes, int offset, int length) { return StringHelper.murmurhash3_x86_32(bytes, offset, length, 0); } }
@Override public boolean accept(BytesRef value) { return Math.floorMod(StringHelper.murmurhash3_x86_32(value, HASH_PARTITIONING_SEED), incNumPartitions) == incZeroBasedPartition; } }
@Override public double score(int docId, float subQueryScore) throws IOException { int hash; if (values == null) { hash = BitMixer.mix(ctx.docBase + docId, saltedSeed); } else if (values.advanceExact(docId)) { hash = StringHelper.murmurhash3_x86_32(values.nextValue(), saltedSeed); } else { // field has no value hash = saltedSeed; } return (hash & 0x00FFFFFF) / (float)(1 << 24); // only use the lower 24 bits to construct a float from 0.0-1.0 }
@Override public LongBitSet acceptedGlobalOrdinals(SortedSetDocValues globalOrdinals) throws IOException { final long numOrds = globalOrdinals.getValueCount(); final LongBitSet acceptedGlobalOrdinals = new LongBitSet(numOrds); final TermsEnum termEnum = globalOrdinals.termsEnum(); BytesRef term = termEnum.next(); while (term != null) { if (Math.floorMod(StringHelper.murmurhash3_x86_32(term, HASH_PARTITIONING_SEED), incNumPartitions) == incZeroBasedPartition) { acceptedGlobalOrdinals.set(termEnum.ord()); } term = termEnum.next(); } return acceptedGlobalOrdinals; } }
public static int hash(byte[] bytes, int offset, int length) { return StringHelper.murmurhash3_x86_32(bytes, offset, length, 0); } }
/** Calculates the hash code as required by TermsHash during indexing. * <p> This is currently implemented as MurmurHash3 (32 * bit), using the seed from {@link * StringHelper#GOOD_FAST_HASH_SEED}, but is subject to * change from release to release. */ @Override public int hashCode() { return StringHelper.murmurhash3_x86_32(this, StringHelper.GOOD_FAST_HASH_SEED); }
/** Calculates the hash code as required by TermsHash during indexing. * <p> This is currently implemented as MurmurHash3 (32 * bit), using the seed from {@link * StringHelper#GOOD_FAST_HASH_SEED}, but is subject to * change from release to release. */ @Override public int hashCode() { return StringHelper.murmurhash3_x86_32(this, StringHelper.GOOD_FAST_HASH_SEED); }
/** Calculates the hash code as required by TermsHash during indexing. * <p> This is currently implemented as MurmurHash3 (32 * bit), using the seed from {@link * StringHelper#GOOD_FAST_HASH_SEED}, but is subject to * change from release to release. */ @Override public int hashCode() { return StringHelper.murmurhash3_x86_32(this, StringHelper.GOOD_FAST_HASH_SEED); }
/** * Returns a DocIdSet per segments containing the matching docs for the specified slice. */ private DocIdSet build(LeafReader reader) throws IOException { final DocIdSetBuilder builder = new DocIdSetBuilder(reader.maxDoc()); final Terms terms = reader.terms(getField()); final TermsEnum te = terms.iterator(); PostingsEnum docsEnum = null; for (BytesRef term = te.next(); term != null; term = te.next()) { // use a fixed seed instead of term.hashCode() otherwise this query may return inconsistent results when // running on another replica (StringHelper sets its default seed at startup with current time) int hashCode = StringHelper.murmurhash3_x86_32(term, SEED); if (contains(hashCode)) { docsEnum = te.postings(docsEnum, PostingsEnum.NONE); builder.add(docsEnum); } } return builder.build(); } }
@Override public boolean accept(BytesRef value) { return Math.floorMod(StringHelper.murmurhash3_x86_32(value, HASH_PARTITIONING_SEED), incNumPartitions) == incZeroBasedPartition; } }
@Override public boolean accept(BytesRef value) { return Math.floorMod(StringHelper.murmurhash3_x86_32(value, HASH_PARTITIONING_SEED), incNumPartitions) == incZeroBasedPartition; } }
@Override public boolean accept(BytesRef value) { return Math.floorMod(StringHelper.murmurhash3_x86_32(value, HASH_PARTITIONING_SEED), incNumPartitions) == incZeroBasedPartition; } }
@Override public boolean accept(BytesRef value) { return Math.floorMod(StringHelper.murmurhash3_x86_32(value, HASH_PARTITIONING_SEED), incNumPartitions) == incZeroBasedPartition; } }
@Override public double score(int docId, float subQueryScore) { uidByteData.setDocument(docId); int hash = StringHelper.murmurhash3_x86_32(uidByteData.valueAt(0), saltedSeed); return (hash & 0x00FFFFFF) / (float)(1 << 24); // only use the lower 24 bits to construct a float from 0.0-1.0 }
@Override public double score(int docId, float subQueryScore) { uidByteData.setDocument(docId); int hash = StringHelper.murmurhash3_x86_32(uidByteData.valueAt(0), saltedSeed); return (hash & 0x00FFFFFF) / (float)(1 << 24); // only use the lower 24 bits to construct a float from 0.0-1.0 }
@Override public double score(int docId, float subQueryScore) { uidByteData.setDocument(docId); int hash = StringHelper.murmurhash3_x86_32(uidByteData.valueAt(0), saltedSeed); return (hash & 0x00FFFFFF) / (float)(1 << 24); // only use the lower 24 bits to construct a float from 0.0-1.0 }
@Override public LongBitSet acceptedGlobalOrdinals(RandomAccessOrds globalOrdinals) throws IOException { final long numOrds = globalOrdinals.getValueCount(); final LongBitSet acceptedGlobalOrdinals = new LongBitSet(numOrds); final TermsEnum termEnum = globalOrdinals.termsEnum(); BytesRef term = termEnum.next(); while (term != null) { if (Math.floorMod(StringHelper.murmurhash3_x86_32(term, HASH_PARTITIONING_SEED), incNumPartitions) == incZeroBasedPartition) { acceptedGlobalOrdinals.set(termEnum.ord()); } term = termEnum.next(); } return acceptedGlobalOrdinals; } }