jlmelville / rcpphnsw

Rcpp bindings for the approximate nearest neighbors library hnswlib
GNU General Public License v3.0
34 stars 10 forks source link

Remove max k check in hnsw_search #5

Closed yxngl closed 5 years ago

yxngl commented 5 years ago

The maximum k should check against the number of items in the index, but there does not seem to be a way to get that number. Currently, it prevents searching with one single data point.

jlmelville commented 5 years ago

Many thanks @yxngl.

jlmelville commented 5 years ago

New to master is a new method, size(), which returns the number of items added to the index. I have not added a check in hnsw_search to compare size() with k to maintain backwards compatibility with older index objects.

I will create a new CRAN release with this PR shortly, but will look to see if the underlying hnsw library can be brought up to date also.

jlmelville commented 5 years ago

Release 0.2.0, which includes the PR and the addition of the size method is now on CRAN.