From 1ef827c849416fc0883430d921dd81444a45a9bd Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 19 Mar 2020 10:54:54 -0400 Subject: [PATCH] [FIX] Remove need of calling createIndex() at end. --- examples/index.py | 3 +++ imsearch/index.py | 1 + 2 files changed, 4 insertions(+) diff --git a/examples/index.py b/examples/index.py index d035d8f..452b07f 100644 --- a/examples/index.py +++ b/examples/index.py @@ -23,6 +23,9 @@ def create_index(name, images): # Add images in batch (List of image paths locally stored) index.addImageBatch(images[1:]) + # Build the index + index.createIndex() + return index diff --git a/imsearch/index.py b/imsearch/index.py index 0aa38dc..11daa96 100644 --- a/imsearch/index.py +++ b/imsearch/index.py @@ -41,6 +41,7 @@ def __init__(self, name): self._repository_db = get_repository(self.name, 'mongo') def __del__(self): + self._nmslib_index.createIndex() Index.object_counter -= 1 if Index.object_counter == 0 and Index.fe is not None: Index.fe.terminate()