fix clippy

This commit is contained in:
ManyTheFish 2023-02-21 10:18:44 +01:00
parent 8aa808d51b
commit bbecab8948
3 changed files with 5 additions and 4 deletions

View File

@ -13,6 +13,8 @@ use crate::{
absolute_from_relative_position, FieldId, Result, MAX_POSITION_PER_ATTRIBUTE, MAX_WORD_LENGTH, absolute_from_relative_position, FieldId, Result, MAX_POSITION_PER_ATTRIBUTE, MAX_WORD_LENGTH,
}; };
pub type ScriptLanguageDocidsMap = HashMap<(Script, Language), RoaringBitmap>;
/// Extracts the word and positions where this word appear and /// Extracts the word and positions where this word appear and
/// prefixes it by the document id. /// prefixes it by the document id.
/// ///
@ -25,7 +27,7 @@ pub fn extract_docid_word_positions<R: io::Read + io::Seek>(
searchable_fields: &Option<HashSet<FieldId>>, searchable_fields: &Option<HashSet<FieldId>>,
stop_words: Option<&fst::Set<&[u8]>>, stop_words: Option<&fst::Set<&[u8]>>,
max_positions_per_attributes: Option<u32>, max_positions_per_attributes: Option<u32>,
) -> Result<(RoaringBitmap, grenad::Reader<File>, HashMap<(Script, Language), RoaringBitmap>)> { ) -> Result<(RoaringBitmap, grenad::Reader<File>, ScriptLanguageDocidsMap)> {
let max_positions_per_attributes = max_positions_per_attributes let max_positions_per_attributes = max_positions_per_attributes
.map_or(MAX_POSITION_PER_ATTRIBUTE, |max| max.min(MAX_POSITION_PER_ATTRIBUTE)); .map_or(MAX_POSITION_PER_ATTRIBUTE, |max| max.min(MAX_POSITION_PER_ATTRIBUTE));
let max_memory = indexer.max_memory_by_thread(); let max_memory = indexer.max_memory_by_thread();

View File

@ -260,7 +260,7 @@ fn send_and_extract_flattened_documents_data(
let (documents_ids, docid_word_positions_chunk, script_language_pair) = let (documents_ids, docid_word_positions_chunk, script_language_pair) =
extract_docid_word_positions( extract_docid_word_positions(
flattened_documents_chunk.clone(), flattened_documents_chunk.clone(),
indexer.clone(), indexer,
searchable_fields, searchable_fields,
stop_words.as_ref(), stop_words.as_ref(),
max_positions_per_attributes, max_positions_per_attributes,

View File

@ -224,8 +224,7 @@ pub(crate) fn write_typed_chunk_into_index(
let mut new_value_buffer = Vec::new(); let mut new_value_buffer = Vec::new();
serialize_roaring_bitmap(&value, &mut new_value_buffer)?; serialize_roaring_bitmap(&value, &mut new_value_buffer)?;
merge_roaring_bitmaps(&new_value_buffer, &db_value_buffer, &mut buffer)?; merge_roaring_bitmaps(&new_value_buffer, &db_value_buffer, &mut buffer)?;
let merged_db_values = RoaringBitmap::deserialize_from(&buffer[..])?; RoaringBitmap::deserialize_from(&buffer[..])?
merged_db_values
} }
None => value, None => value,
}; };