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

Fix logic for finding first error in loading coll from disk.

Kishore Nallan6466249f7621
diff --git a/include/collection_manager.h b/include/collection_manager.h
index e572200a..4ecd5f5f 100644
--- a/include/collection_manager.h
+++ b/include/collection_manager.h
@@ -85,14 +85,14 @@ private:
~CollectionManager() = default;
- static Option<std::string> get_first_index_error(const std::vector<index_record>& index_records) {
+ static std::string get_first_index_error(const std::vector<index_record>& index_records) {
for(const auto & index_record: index_records) {
if(!index_record.indexed.ok()) {
- return Option<std::string>(index_record.indexed.error());
+ return index_record.indexed.error();
}
}
- return Option<std::string>(404, "Not found");
+ return "";
}
public:
diff --git a/src/collection_manager.cpp b/src/collection_manager.cpp
index 2f6549a0..262f8e01 100644
--- a/src/collection_manager.cpp
+++ b/src/collection_manager.cpp
@@ -2405,9 +2405,10 @@ Option<bool> CollectionManager::load_collection(const nlohmann::json &collection
batch_doc_str_size = 0;
if(num_indexed != num_records) {
- const Option<std::string> & index_error_op = get_first_index_error(index_records);
- if(!index_error_op.ok()) {
- return Option<bool>(400, index_error_op.get());
+ const std::string& index_error = get_first_index_error(index_records);
+ if(!index_error.empty()) {
+ // for now, we will just ignore errors during loading of collection
+ //return Option<bool>(400, index_error);
}
}