Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Fixed failing test.

Kishore Nallane22297e249fb
diff --git a/include/index.h b/include/index.h
index 9c2c1113..13aa537e 100644
--- a/include/index.h
+++ b/include/index.h
@@ -101,7 +101,7 @@ struct index_record {
Option<bool> indexed; // indicates if the indexing operation was a success
index_record(size_t record_pos, uint32_t seq_id, const nlohmann::json& doc, index_operation_t operation):
- position(record_pos), seq_id(seq_id), doc(doc), operation(operation), indexed(false) {
+ position(record_pos), seq_id(seq_id), doc(doc), operation(operation), is_update(false), indexed(false) {
}
diff --git a/src/collection_manager.cpp b/src/collection_manager.cpp
index ce9e8ea1..59ee29dc 100644
--- a/src/collection_manager.cpp
+++ b/src/collection_manager.cpp
@@ -195,7 +195,7 @@ Option<bool> CollectionManager::load(const size_t init_batch_size) {
if(num_indexed != num_records) {
const Option<std::string> & index_error_op = get_first_index_error(iter_batch[i]);
- if(index_error_op.ok()) {
+ if(!index_error_op.ok()) {
return Option<bool>(false, index_error_op.get());
}
}
diff --git a/test/collection_manager_test.cpp b/test/collection_manager_test.cpp
index 63fbea4e..da84b0d5 100644
--- a/test/collection_manager_test.cpp
+++ b/test/collection_manager_test.cpp
@@ -213,7 +213,13 @@ TEST_F(CollectionManagerTest, RestoreRecordsOnRestart) {
// create a new collection manager to ensure that it restores the records from the disk backed store
CollectionManager & collectionManager2 = CollectionManager::get_instance();
collectionManager2.init(store, 1.0, "auth_key");
- collectionManager2.load();
+ auto load_op = collectionManager2.load();
+
+ if(!load_op.ok()) {
+ LOG(ERROR) << load_op.error();
+ }
+
+ ASSERT_TRUE(load_op.ok());
collection1 = collectionManager2.get_collection("collection1");
ASSERT_NE(nullptr, collection1);