mezis / blurrily

Millisecond fuzzy string matching for Ruby
MIT License
90 stars 14 forks source link

Unable to re-add reference id after deleting #32

Closed thorvaldurhelga closed 9 years ago

thorvaldurhelga commented 9 years ago

For example:

client.put('London 1', 1337) client.find('London')

=> [1337]

client.delete(1337) client.put('London 2', 1337) client.find('London')

=> []

The only way to re-add a previously deleted id that I've found is by clearing the client, which is not feasible when maintaining a big dictionary.

Also, it seems that the Client find() method only returns [REF] instead of "an Array of matching [REF,SCORE,WEIGHT] ordered by score." like it says in the documentation and the Map class returns.

mezis commented 9 years ago

Hi @thorvaldurhelga, thanks for the feedback.

I'll investigate both problems (no promises, but I'll definitely be able to take a look this week).

thorvaldurhelga commented 9 years ago

Great! Thanks for the quick reply!

mezis commented 9 years ago

Didn't find the cause of the issue yet — I'll keep digging. I'll update this thread when done. If you have a clue what the problem is @thorvaldurhelga, do mention it ^_^

thorvaldurhelga commented 9 years ago

I found the source of the first problem and I've submitted a pull request with the fix: https://github.com/mezis/blurrily/pull/33

mezis commented 9 years ago

You're right about the documentation—only the reference is returned. It's a pretty simple fix, although it'll break API compatibility (I'll bump the major version number).

mezis commented 9 years ago

@thorvaldurhelga, I've just releases version 1.0.0 with both fixes. Thanks again for your help!

thorvaldurhelga commented 9 years ago

Brilliant, thanks!