Skip to content

Commit bb124f6

Browse files
authored
Merge branch 'master' into sis/add-serialize-deserialize-methods
2 parents 1cfc00b + bc4d79b commit bb124f6

File tree

4 files changed

+46
-20
lines changed

4 files changed

+46
-20
lines changed

README.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,47 @@ The following additional types are implemented, but less tested:
2727

2828
## Usage
2929

30-
When using Maven:
30+
### Maven
31+
32+
When using Maven: The latest version, 1.0.4, is not yet available on Maven central, see [issue #48](https://github.com/FastFilter/fastfilter_java/issues/48). However, it is available at https://jitpack.io/:
33+
34+
<repositories>
35+
<repository>
36+
<id>jitpack.io</id>
37+
<url>https://jitpack.io</url>
38+
</repository>
39+
</repositories>
3140

3241
<dependency>
33-
<groupId>io.github.fastfilter</groupId>
34-
<artifactId>fastfilter</artifactId>
35-
<version>1.0.4</version>
42+
<groupId>io.github.fastfilter</groupId>
43+
<artifactId>fastfilter</artifactId>
44+
<version>1.0.4</version>
3645
</dependency>
3746

47+
### Gradle
48+
49+
repositories {
50+
mavenCentral()
51+
maven {
52+
url 'https://jitpack.io'
53+
}
54+
}
55+
56+
dependencies {
57+
implementation 'io.github.fastfilter.fastfilter_java:fastfilter:1.0.4'
58+
}
59+
60+
### Maven Central (version 1.0.2)
61+
62+
The older version, 1.0.2, is available on Maven central.
63+
64+
<dependency>
65+
<groupId>io.github.fastfilter</groupId>
66+
<artifactId>fastfilter</artifactId>
67+
<version>1.0.2</version>
68+
</dependency>
69+
70+
3871
# Other Xor Filter Implementations
3972

4073
* [C](https://github.com/FastFilter/xor_singleheader)

fastfilter/src/main/java/org/fastfilter/xor/XorBinaryFuse16.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,9 @@ private void addAll(long[] keys) {
206206

207207
if (hashIndex > 100) {
208208
// if construction doesn't succeed eventually,
209-
// then there is likely a problem with the hash function
210-
// let us not crash the system:
211-
Arrays.fill(fingerprints, (short) 0xFFFF);
212-
return;
209+
// then there is likely a problem with the hash function.
210+
// It's better fail that either produce non-functional or incorrect filter.
211+
throw new IllegalArgumentException("could not construct filter");
213212
}
214213
// use a new random number
215214
seed = Hash.randomSeed();

fastfilter/src/main/java/org/fastfilter/xor/XorBinaryFuse32.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,9 @@ private void addAll(long[] keys) {
207207

208208
if (hashIndex > 100) {
209209
// if construction doesn't succeed eventually,
210-
// then there is likely a problem with the hash function
211-
// let us not crash the system:
212-
for (int i = 0; i < fingerprints.length; i++) {
213-
fingerprints[i] = (int) 0xFFFFFFFF;
214-
}
215-
return;
210+
// then there is likely a problem with the hash function.
211+
// It's better fail that either produce non-functional or incorrect filter.
212+
throw new IllegalArgumentException("could not construct filter");
216213
}
217214
// use a new random numbers
218215
seed = Hash.randomSeed();

fastfilter/src/main/java/org/fastfilter/xor/XorBinaryFuse8.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,9 @@ private void addAll(long[] keys) {
207207

208208
if (hashIndex > 100) {
209209
// if construction doesn't succeed eventually,
210-
// then there is likely a problem with the hash function
211-
// let us not crash the system:
212-
for(int i = 0; i < fingerprints.length; i++) {
213-
fingerprints[i] = (byte)0xFF;
214-
}
215-
return;
210+
// then there is likely a problem with the hash function.
211+
// It's better fail that either produce non-functional or incorrect filter.
212+
throw new IllegalArgumentException("could not construct filter");
216213
}
217214
// use a new random numbers
218215
seed = Hash.randomSeed();

0 commit comments

Comments
 (0)