Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding string to cuckoo filter #39

Open
Uroojt opened this issue Jul 1, 2020 · 3 comments
Open

adding string to cuckoo filter #39

Uroojt opened this issue Jul 1, 2020 · 3 comments

Comments

@Uroojt
Copy link

Uroojt commented Jul 1, 2020

I'm trying to add string to the cuckoofilter library
https://github.com/efficient/cuckoofilter/blob/master/src/cuckoofilter.h

mycode

cuckoofilter::CuckooFilter<string, 12> cuckoo_mempool(total_items);

but every time I run the code error will appear on line
[https://github.com/efficient/cuckoofilter/blob/master/src/cuckoofilter.h#L68]

error: no match for call to ‘(const cuckoofilter::TwoIndependentMultiplyShift) (const std::_cxx11::basic_string&)’
68 | const uint64_t hash = hasher
(item);
| ^~~~

@siara-cc
Copy link

I faced the same issue and it looks like according to the implementation the first parameter can only be uint64_t.
So I used following code:

std::string mystring = "Hello World";
cuckoofilter::CuckooFilter<size_t, 12> test(1000);
test.Add(CityHash64(mystring.c_str(), mystring.length()));

CitiHash64 can be found in src/City.h in https://github.com/aappleby/smhasher

@Tom-CaoZH
Copy link

I wonder adding a hash function whether will impact the results(like false positive and etc) @siara-cc

@siara-cc
Copy link

siara-cc commented Jul 7, 2023

Hash function is the basis of such filters and so using a better hash function results in a better false positive rate. A poor hash function will have more "collisions" means the function produces same result for different input values and so will result in more false positives. @Tom-CaoZH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants