diff --git a/.DS_Store b/.DS_Store index aecd469..cb80f62 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/python_bindings/.DS_Store b/python_bindings/.DS_Store index e24f253..933c8e5 100644 Binary files a/python_bindings/.DS_Store and b/python_bindings/.DS_Store differ diff --git a/python_bindings/nmslib.cc b/python_bindings/nmslib.cc index 980b0b8..87e8f6d 100644 --- a/python_bindings/nmslib.cc +++ b/python_bindings/nmslib.cc @@ -579,6 +579,23 @@ void exportIndex(py::module * m) { " A 1D vector of the ids of each nearest neighbour.\n" "distances: array_like.\n" " A 1D vector of the distance to each nearest neigbhour.\n") + + .def("rangeQuery", &IndexWrapper::rangeQuery, + py::arg("vector"), py::arg("radius") = 0.2, + "Finds the neighbours of a vector in the index, with distance smaller than the radius \n\n" + "Parameters\n" + "----------\n" + "vector: array_like\n" + " A 1D vector to query for.\n" + "radius: float optional\n" + " The radius\n" + "\n" + "Returns\n" + "----------\n" + "ids: array_like.\n" + " A 1D vector of the ids of each nearest neighbour.\n" + "distances: array_like.\n" + " A 1D vector of the distance to each nearest neigbhour.\n") .def("knnQueryBatch", &IndexWrapper::knnQueryBatch, py::arg("queries"), py::arg("k") = 10, py::arg("num_threads") = 0, @@ -775,6 +792,11 @@ void exportLegacyAPI(py::module * m) { py::list ids(ret[0]); return ids; }); + m->def("rangeQuery", [](py::object self, dist_t radius, py::object query) { + py::tuple ret = self.attr("rangeQuery")(query, radius); + py::list ids(ret[0]); + return ids; + }); m->def("getDataPoint", [](py::object self, size_t pos) { return self.attr("__getitem__")(pos); }); diff --git a/similarity_search/.DS_Store b/similarity_search/.DS_Store index 39e1a75..9c50c20 100644 Binary files a/similarity_search/.DS_Store and b/similarity_search/.DS_Store differ