Closed leesf closed 7 years ago
It returns true
for me. I added a commit with your code https://github.com/alexandrnikitin/bloom-filter-scala/commit/1493f2c611e287ab1466efe8fea765fe10aacb38 Try it please.
Make sure you use the latest version. It's 0.7.0
at the moment.
@alexandrnikitin Thanks for replying. I have already used 0.7.0 and changed the code, however, it still returns false for me, the computedHash in add operation and mightContain is different when debugging.
@alexandrnikitin However, when i use the following code, it returns true.
val expectedElements = 1000 val falsePositiveRate = 0.1 val bf = BloomFilter[Array[Byte]](expectedElements, falsePositiveRate)
// Put an element bf.add("lee".getBytes)
// Check whether an element in a set bf.mightContain("lee".getBytes) // return true
bf.dispose()
It is so odd. And i do not know how it happens.
@leesf Hmm, interesting, could you please push a unit test to this repository that reproduces that behavior in your environment.
@alexandrnikitin , I would push a unit test to the repository with pleasure, but exactly i don't know how to conduct a unit test.
@leesf Another option is to change the example application like I did here https://github.com/alexandrnikitin/bloom-filter-scala/commit/1493f2c611e287ab1466efe8fea765fe10aacb38
When i use the example on the main page i add element to the bloomfilter, however, when using mightContain method to check whether an element in a set. it returns false.Why?
val expectedElements = 1000000 val falsePositiveRate = 0.1 val bf = BloomFilter[String](expectedElements, falsePositiveRate)
// Put an element bf.add("lee")
// Check whether an element in a set bf.mightContain("lee") // return false
// Dispose the instance bf.dispose()