mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
fix silent deserialize error
This commit is contained in:
parent
eeb0c70ea2
commit
57898d8a90
@ -95,7 +95,11 @@ impl Transform<'_, '_> {
|
|||||||
|
|
||||||
// We extract the primary key from the first document in
|
// We extract the primary key from the first document in
|
||||||
// the batch if it hasn't already been defined in the index
|
// the batch if it hasn't already been defined in the index
|
||||||
let first = documents.peek().and_then(|r| r.as_ref().ok());
|
let first = match documents.peek().map(Result::as_ref).transpose() {
|
||||||
|
Ok(first) => first,
|
||||||
|
Err(_) => return Err(documents.next().unwrap().unwrap_err().into()),
|
||||||
|
};
|
||||||
|
|
||||||
let alternative_name = first.and_then(|doc| doc.keys().find(|f| is_primary_key(f)).cloned());
|
let alternative_name = first.and_then(|doc| doc.keys().find(|f| is_primary_key(f)).cloned());
|
||||||
let (primary_key_id, primary_key) = compute_primary_key_pair(
|
let (primary_key_id, primary_key) = compute_primary_key_pair(
|
||||||
self.index.primary_key(self.rtxn)?,
|
self.index.primary_key(self.rtxn)?,
|
||||||
@ -236,7 +240,7 @@ impl Transform<'_, '_> {
|
|||||||
// The primary key is known so we must find the position in the CSV headers.
|
// The primary key is known so we must find the position in the CSV headers.
|
||||||
headers.iter().position(|h| h == primary_key)
|
headers.iter().position(|h| h == primary_key)
|
||||||
},
|
},
|
||||||
None => headers.iter().position(|f| is_primary_key(&f)),
|
None => headers.iter().position(is_primary_key),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns the field id in the fields ids map, create an "id" field
|
// Returns the field id in the fields ids map, create an "id" field
|
||||||
|
Loading…
Reference in New Issue
Block a user