mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-24 13:40:31 +01:00
Merge #350
350: Fix mdb val size error r=Kerollmops a=ManyTheFish Related to [#1677](https://github.com/meilisearch/MeiliSearch/issues/1677) Co-authored-by: many <maxime@meilisearch.com>
This commit is contained in:
commit
86c3b0c8c2
@ -67,6 +67,7 @@ pub fn extract_docid_word_positions<R: io::Read>(
|
||||
|
||||
for (index, token) in tokens {
|
||||
let token = token.text().trim();
|
||||
if !token.is_empty() {
|
||||
key_buffer.truncate(mem::size_of::<u32>());
|
||||
key_buffer.extend_from_slice(token.as_bytes());
|
||||
|
||||
@ -74,7 +75,9 @@ pub fn extract_docid_word_positions<R: io::Read>(
|
||||
.try_into()
|
||||
.map_err(|_| SerializationError::InvalidNumberSerialization)?;
|
||||
let position = field_id as u32 * ONE_ATTRIBUTE + position;
|
||||
docid_word_positions_sorter.insert(&key_buffer, &position.to_ne_bytes())?;
|
||||
docid_word_positions_sorter
|
||||
.insert(&key_buffer, &position.to_ne_bytes())?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ pub use merge_functions::{
|
||||
};
|
||||
|
||||
pub fn valid_lmdb_key(key: impl AsRef<[u8]>) -> bool {
|
||||
key.as_ref().len() <= 511
|
||||
key.as_ref().len() <= 511 && !key.as_ref().is_empty()
|
||||
}
|
||||
|
||||
/// Divides one slice into two at an index, returns `None` if mid is out of bounds.
|
||||
|
Loading…
x
Reference in New Issue
Block a user