mirror of
https://github.com/typesense/typesense.git
synced 2025-05-19 13:12:22 +08:00
Skip validation of embedding field while reindexing
This commit is contained in:
parent
7e97b767a5
commit
b2d07d9a66
@ -31,7 +31,7 @@ public:
|
||||
const index_operation_t op,
|
||||
const bool is_update,
|
||||
const std::string& fallback_field_type,
|
||||
const DIRTY_VALUES& dirty_values);
|
||||
const DIRTY_VALUES& dirty_values, const bool validate_embedding_fields = true);
|
||||
|
||||
|
||||
static Option<uint32_t> coerce_element(const field& a_field, nlohmann::json& document,
|
||||
|
@ -3776,9 +3776,9 @@ Option<bool> Collection::batch_alter_data(const std::vector<field>& alter_fields
|
||||
index->remove(seq_id, rec.doc, del_fields, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Index::batch_memory_index(index, iter_batch, default_sorting_field, schema_additions, embedding_fields,
|
||||
fallback_field_type, token_separators, symbols_to_index, true);
|
||||
fallback_field_type, token_separators, symbols_to_index, true, false);
|
||||
|
||||
iter_batch.clear();
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ void Index::validate_and_preprocess(Index *index, std::vector<index_record>& ite
|
||||
index_rec.operation,
|
||||
index_rec.is_update,
|
||||
fallback_field_type,
|
||||
index_rec.dirty_values);
|
||||
index_rec.dirty_values, generate_embeddings);
|
||||
|
||||
if(!validation_op.ok()) {
|
||||
index_rec.index_failure(validation_op.code(), validation_op.error());
|
||||
|
@ -605,7 +605,7 @@ Option<uint32_t> validator_t::validate_index_in_memory(nlohmann::json& document,
|
||||
const index_operation_t op,
|
||||
const bool is_update,
|
||||
const std::string& fallback_field_type,
|
||||
const DIRTY_VALUES& dirty_values) {
|
||||
const DIRTY_VALUES& dirty_values, const bool validate_embedding_fields) {
|
||||
|
||||
bool missing_default_sort_field = (!default_sorting_field.empty() && document.count(default_sorting_field) == 0);
|
||||
|
||||
@ -652,10 +652,12 @@ Option<uint32_t> validator_t::validate_index_in_memory(nlohmann::json& document,
|
||||
}
|
||||
}
|
||||
|
||||
// validate embedding fields
|
||||
auto validate_embed_op = validate_embed_fields(document, embedding_fields, search_schema, !is_update);
|
||||
if(!validate_embed_op.ok()) {
|
||||
return Option<>(validate_embed_op.code(), validate_embed_op.error());
|
||||
if(validate_embedding_fields) {
|
||||
// validate embedding fields
|
||||
auto validate_embed_op = validate_embed_fields(document, embedding_fields, search_schema, !is_update);
|
||||
if(!validate_embed_op.ok()) {
|
||||
return Option<>(validate_embed_op.code(), validate_embed_op.error());
|
||||
}
|
||||
}
|
||||
|
||||
return Option<>(200);
|
||||
|
Loading…
x
Reference in New Issue
Block a user