mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 16:51:01 +00:00
Reduce the DocumentId size from 64 to 32bits
This commit is contained in:
@ -242,7 +242,7 @@ pub fn apply_addition<'a, 'b>(
|
||||
|
||||
index.main.put_schema(writer, &schema)?;
|
||||
|
||||
let new_user_ids = fst::Map::from_iter(new_user_ids)?;
|
||||
let new_user_ids = fst::Map::from_iter(new_user_ids.iter().map(|(u, i)| (u, *i as u64)))?;
|
||||
let new_internal_ids = sdset::SetBuf::from_dirty(new_internal_ids);
|
||||
index.main.merge_user_ids(writer, &new_user_ids)?;
|
||||
index.main.merge_internal_ids(writer, &new_internal_ids)?;
|
||||
|
@ -80,7 +80,7 @@ pub fn apply_documents_deletion(
|
||||
let user_ids = index.main.user_ids(writer)?;
|
||||
for userid in new_user_ids.as_slice() {
|
||||
if let Some(id) = user_ids.get(userid) {
|
||||
internal_ids.push(DocumentId(id));
|
||||
internal_ids.push(DocumentId(id as u32));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ pub fn discover_document_id(
|
||||
{
|
||||
if userid.chars().all(|x| x.is_ascii_alphanumeric() || x == '-' || x == '_') {
|
||||
match user_ids.get(userid) {
|
||||
Some(internal_id) => Ok(DocumentId(internal_id)),
|
||||
Some(id) => Ok(DocumentId(id as u32)),
|
||||
None => {
|
||||
let internal_id = available_ids.next().expect("no more ids available");
|
||||
Ok(internal_id)
|
||||
|
Reference in New Issue
Block a user