mirror of
https://github.com/typesense/typesense.git
synced 2025-05-20 21:52:23 +08:00
Fix logic for finding first error in loading coll from disk.
This commit is contained in:
parent
0b75cdcc3d
commit
6466249f76
@ -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:
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user