From 04dcaa05e3597752536cf53347fb0554c8f9ec79 Mon Sep 17 00:00:00 2001 From: ChunjiangZhu Date: Thu, 24 Oct 2019 15:16:27 -0400 Subject: [PATCH] fix bug --- python_bindings/nmslib.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python_bindings/nmslib.cc b/python_bindings/nmslib.cc index 0f783cf..f848874 100644 --- a/python_bindings/nmslib.cc +++ b/python_bindings/nmslib.cc @@ -199,16 +199,17 @@ struct IndexWrapper { py::object convertResult_rq(std::set res) { // Create numpy arrays for the output - size_t size = res.Size(); + size_t size = res.size(); py::array_t ids(size); py::array_t distances(size); std::set::iterator it = res.begin(); + int i=0; while (it != res.end()) { - ids.mutable_at(i) = it->id(); + ids.mutable_at(i) = (*it)->id(); //distances.mutable_at(size) = res->at(i)->id(); - it++; + it++; i++; } return py::make_tuple(ids, distances); }