Skip to content

adding string to cuckoo filter #39

Open

Description

@Uroojt

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);
| ^~~~

Activity

  1. siara-cc commented on May 13, 2023

    @siara-cc

    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

  2. Tom-CaoZH commented on Jul 7, 2023

    @Tom-CaoZH

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

  3. siara-cc commented on Jul 7, 2023

    @siara-cc

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions