From b85cd4983ea01b062ce5e3a2c79a8a3a06f7b0ed Mon Sep 17 00:00:00 2001 From: ad hoc Date: Tue, 5 Apr 2022 09:50:34 +0200 Subject: [PATCH] remove field_id_from_position --- milli/src/lib.rs | 4 ---- .../src/update/index_documents/extract/extract_word_docids.rs | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/milli/src/lib.rs b/milli/src/lib.rs index b68c76048..ba2bd9b0f 100644 --- a/milli/src/lib.rs +++ b/milli/src/lib.rs @@ -74,10 +74,6 @@ pub fn absolute_from_relative_position(field_id: FieldId, relative: RelativePosi (field_id as u32) << 16 | (relative as u32) } -pub fn field_id_from_position(position: u32) -> FieldId { - (position >> 16 & 0xffff) as u16 -} - /// Transform a raw obkv store into a JSON Object. pub fn obkv_to_json( displayed_fields: &[FieldId], diff --git a/milli/src/update/index_documents/extract/extract_word_docids.rs b/milli/src/update/index_documents/extract/extract_word_docids.rs index 5083bbd90..0f8b4c039 100644 --- a/milli/src/update/index_documents/extract/extract_word_docids.rs +++ b/milli/src/update/index_documents/extract/extract_word_docids.rs @@ -12,7 +12,7 @@ use super::helpers::{ use crate::error::SerializationError; use crate::index::db_name::DOCID_WORD_POSITIONS; use crate::update::index_documents::helpers::read_u32_ne_bytes; -use crate::{field_id_from_position, FieldId, Result}; +use crate::{relative_from_absolute_position, FieldId, Result}; /// Extracts the word and the documents ids where this word appear. /// @@ -67,7 +67,7 @@ pub fn extract_word_docids( if added_to_exact && added_to_word_docids { break; } - let fid = field_id_from_position(position); + let (fid, _) = relative_from_absolute_position(position); if exact_attributes.contains(&fid) && !added_to_exact { exact_word_docids_sorter.insert(word_bytes, &value_buffer)?; added_to_exact = true;