mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-30 07:26:26 +00:00 
			
		
		
		
	Remove the FacetValueStringCodec
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| use std::collections::{BTreeMap, HashSet}; | ||||
| use std::ops::Bound::Unbounded; | ||||
| use std::{cmp, fmt}; | ||||
| use std::{cmp, fmt, mem}; | ||||
|  | ||||
| use heed::types::{ByteSlice, Unit}; | ||||
| use heed::{BytesDecode, Database}; | ||||
| @@ -8,7 +8,7 @@ use roaring::RoaringBitmap; | ||||
|  | ||||
| use crate::error::{FieldIdMapMissingEntry, UserError}; | ||||
| use crate::facet::FacetType; | ||||
| use crate::heed_codec::facet::FacetValueStringCodec; | ||||
| use crate::heed_codec::facet::FacetStringLevelZeroCodec; | ||||
| use crate::search::facet::{FacetNumberIter, FacetNumberRange}; | ||||
| use crate::{DocumentId, FieldId, Index, Result}; | ||||
|  | ||||
| @@ -81,7 +81,7 @@ impl<'a> FacetDistribution<'a> { | ||||
|             let mut key_buffer: Vec<_> = field_id.to_be_bytes().iter().copied().collect(); | ||||
|  | ||||
|             for docid in candidates.into_iter().take(CANDIDATES_THRESHOLD as usize) { | ||||
|                 key_buffer.truncate(1); | ||||
|                 key_buffer.truncate(mem::size_of::<FieldId>()); | ||||
|                 key_buffer.extend_from_slice(&docid.to_be_bytes()); | ||||
|                 let iter = db | ||||
|                     .remap_key_type::<ByteSlice>() | ||||
| @@ -158,7 +158,7 @@ impl<'a> FacetDistribution<'a> { | ||||
|             .facet_id_string_docids | ||||
|             .remap_key_type::<ByteSlice>() | ||||
|             .prefix_iter(self.rtxn, &field_id.to_be_bytes())? | ||||
|             .remap_key_type::<FacetValueStringCodec>(); | ||||
|             .remap_key_type::<FacetStringLevelZeroCodec>(); | ||||
|  | ||||
|         for result in iter { | ||||
|             let ((_, value), docids) = result?; | ||||
|   | ||||
| @@ -130,7 +130,7 @@ use std::ops::Bound; | ||||
| use std::ops::Bound::{Excluded, Included, Unbounded}; | ||||
|  | ||||
| use either::{Either, Left, Right}; | ||||
| use heed::types::{ByteSlice, DecodeIgnore, Str}; | ||||
| use heed::types::{ByteSlice, DecodeIgnore}; | ||||
| use heed::{Database, LazyDecode, RoRange}; | ||||
| use roaring::RoaringBitmap; | ||||
|  | ||||
| @@ -298,10 +298,10 @@ impl<'t> FacetStringIter<'t> { | ||||
|     ) -> heed::Result<Option<u8>> { | ||||
|         Ok(db | ||||
|             .remap_types::<ByteSlice, DecodeIgnore>() | ||||
|             .prefix_iter(rtxn, &[fid][..])? // the field id is the first bit | ||||
|             .prefix_iter(rtxn, &fid.to_be_bytes())? // the field id is the first two bits | ||||
|             .last() | ||||
|             .transpose()? | ||||
|             .map(|(key_bytes, _)| key_bytes[1])) // the level is the second bit | ||||
|             .map(|(key_bytes, _)| key_bytes[2])) // the level is the third bit | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -17,7 +17,7 @@ use self::Operator::*; | ||||
| use super::parser::{FilterParser, Rule, PREC_CLIMBER}; | ||||
| use super::FacetNumberRange; | ||||
| use crate::error::UserError; | ||||
| use crate::heed_codec::facet::{FacetLevelValueF64Codec, FacetValueStringCodec}; | ||||
| use crate::heed_codec::facet::{FacetLevelValueF64Codec, FacetStringLevelZeroCodec}; | ||||
| use crate::{CboRoaringBitmapCodec, FieldId, FieldsIdsMap, Index, Result}; | ||||
|  | ||||
| #[derive(Debug, Clone, PartialEq)] | ||||
| @@ -363,7 +363,7 @@ impl FilterCondition { | ||||
|         rtxn: &heed::RoTxn, | ||||
|         index: &Index, | ||||
|         numbers_db: heed::Database<FacetLevelValueF64Codec, CboRoaringBitmapCodec>, | ||||
|         strings_db: heed::Database<FacetValueStringCodec, CboRoaringBitmapCodec>, | ||||
|         strings_db: heed::Database<FacetStringLevelZeroCodec, CboRoaringBitmapCodec>, | ||||
|         field_id: FieldId, | ||||
|         operator: &Operator, | ||||
|     ) -> Result<RoaringBitmap> { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user