mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-27 15:10:05 +01:00
cargo fmt
This commit is contained in:
parent
36296bbb20
commit
a7201ece04
@ -1,6 +1,9 @@
|
||||
use std::borrow::Cow;
|
||||
use std::convert::TryFrom;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use heed::{BytesDecode, BytesEncode};
|
||||
use roaring::RoaringBitmap;
|
||||
use std::{borrow::Cow, convert::TryFrom, marker::PhantomData};
|
||||
|
||||
pub mod ordered_f64_codec;
|
||||
pub mod str_ref;
|
||||
|
@ -1,4 +1,5 @@
|
||||
use std::{borrow::Cow, convert::TryInto};
|
||||
use std::borrow::Cow;
|
||||
use std::convert::TryInto;
|
||||
|
||||
use heed::BytesDecode;
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
use crate::heed_codec::facet::new::{FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice};
|
||||
use heed::Result;
|
||||
use roaring::RoaringBitmap;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use heed::Result;
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use super::{get_first_facet_value, get_highest_level};
|
||||
use crate::heed_codec::facet::new::{FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice};
|
||||
|
||||
pub fn iterate_over_facet_distribution<'t, CB>(
|
||||
rtxn: &'t heed::RoTxn<'t>,
|
||||
@ -108,16 +109,16 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::milli_snap;
|
||||
use crate::{
|
||||
heed_codec::facet::new::ordered_f64_codec::OrderedF64Codec, search::facet::test::FacetIndex,
|
||||
};
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use heed::BytesDecode;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use roaring::RoaringBitmap;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use super::iterate_over_facet_distribution;
|
||||
use crate::heed_codec::facet::new::ordered_f64_codec::OrderedF64Codec;
|
||||
use crate::milli_snap;
|
||||
use crate::search::facet::test::FacetIndex;
|
||||
|
||||
fn get_simple_index() -> FacetIndex<OrderedF64Codec> {
|
||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8);
|
||||
|
@ -1,18 +1,12 @@
|
||||
use std::ops::{Bound, RangeBounds};
|
||||
|
||||
use heed::BytesEncode;
|
||||
use roaring::RoaringBitmap;
|
||||
use std::ops::Bound;
|
||||
use std::ops::RangeBounds;
|
||||
|
||||
use crate::heed_codec::facet::new::FacetGroupValueCodec;
|
||||
use crate::heed_codec::facet::new::FacetKey;
|
||||
use crate::heed_codec::facet::new::FacetKeyCodec;
|
||||
use crate::heed_codec::facet::new::MyByteSlice;
|
||||
use super::{get_first_facet_value, get_highest_level, get_last_facet_value};
|
||||
use crate::heed_codec::facet::new::{FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice};
|
||||
use crate::Result;
|
||||
|
||||
use super::get_first_facet_value;
|
||||
use super::get_highest_level;
|
||||
use super::get_last_facet_value;
|
||||
|
||||
pub fn find_docids_of_facet_within_bounds<'t, BoundCodec>(
|
||||
rtxn: &'t heed::RoTxn<'t>,
|
||||
db: heed::Database<FacetKeyCodec<BoundCodec>, FacetGroupValueCodec>,
|
||||
@ -258,17 +252,17 @@ impl<'t, 'b, 'bitmap> FacetRangeSearch<'t, 'b, 'bitmap> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::milli_snap;
|
||||
use crate::{
|
||||
heed_codec::facet::new::{ordered_f64_codec::OrderedF64Codec, FacetKeyCodec},
|
||||
search::facet::test::FacetIndex,
|
||||
snapshot_tests::display_bitmap,
|
||||
};
|
||||
use rand::{Rng, SeedableRng};
|
||||
use roaring::RoaringBitmap;
|
||||
use std::ops::Bound;
|
||||
|
||||
use rand::{Rng, SeedableRng};
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use super::find_docids_of_facet_within_bounds;
|
||||
use crate::heed_codec::facet::new::ordered_f64_codec::OrderedF64Codec;
|
||||
use crate::heed_codec::facet::new::FacetKeyCodec;
|
||||
use crate::milli_snap;
|
||||
use crate::search::facet::test::FacetIndex;
|
||||
use crate::snapshot_tests::display_bitmap;
|
||||
|
||||
fn get_simple_index() -> FacetIndex<OrderedF64Codec> {
|
||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8);
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::heed_codec::facet::new::{
|
||||
FacetGroupValue, FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice,
|
||||
};
|
||||
use heed::Result;
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use super::{get_first_facet_value, get_highest_level};
|
||||
use crate::heed_codec::facet::new::{
|
||||
FacetGroupValue, FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice,
|
||||
};
|
||||
|
||||
pub fn ascending_facet_sort<'t>(
|
||||
rtxn: &'t heed::RoTxn<'t>,
|
||||
@ -83,16 +83,15 @@ impl<'t, 'e> Iterator for AscendingFacetSort<'t, 'e> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::milli_snap;
|
||||
use crate::{
|
||||
heed_codec::facet::new::ordered_f64_codec::OrderedF64Codec,
|
||||
search::facet::{facet_sort_ascending::ascending_facet_sort, test::FacetIndex},
|
||||
snapshot_tests::display_bitmap,
|
||||
};
|
||||
use rand::Rng;
|
||||
use rand::SeedableRng;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use crate::heed_codec::facet::new::ordered_f64_codec::OrderedF64Codec;
|
||||
use crate::milli_snap;
|
||||
use crate::search::facet::facet_sort_ascending::ascending_facet_sort;
|
||||
use crate::search::facet::test::FacetIndex;
|
||||
use crate::snapshot_tests::display_bitmap;
|
||||
|
||||
fn get_simple_index() -> FacetIndex<OrderedF64Codec> {
|
||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8);
|
||||
let mut txn = index.env.write_txn().unwrap();
|
||||
|
@ -1,12 +1,12 @@
|
||||
use std::ops::Bound;
|
||||
|
||||
use crate::heed_codec::facet::new::{
|
||||
FacetGroupValue, FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice,
|
||||
};
|
||||
use heed::Result;
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use super::{get_first_facet_value, get_highest_level, get_last_facet_value};
|
||||
use crate::heed_codec::facet::new::{
|
||||
FacetGroupValue, FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice,
|
||||
};
|
||||
|
||||
pub fn descending_facet_sort<'t>(
|
||||
rtxn: &'t heed::RoTxn<'t>,
|
||||
@ -111,16 +111,16 @@ impl<'t> Iterator for DescendingFacetSort<'t> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::milli_snap;
|
||||
use crate::{
|
||||
heed_codec::facet::new::{ordered_f64_codec::OrderedF64Codec, FacetKeyCodec, MyByteSlice},
|
||||
search::facet::{facet_sort_descending::descending_facet_sort, test::FacetIndex},
|
||||
snapshot_tests::display_bitmap,
|
||||
};
|
||||
use rand::Rng;
|
||||
use rand::SeedableRng;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use crate::heed_codec::facet::new::ordered_f64_codec::OrderedF64Codec;
|
||||
use crate::heed_codec::facet::new::{FacetKeyCodec, MyByteSlice};
|
||||
use crate::milli_snap;
|
||||
use crate::search::facet::facet_sort_descending::descending_facet_sort;
|
||||
use crate::search::facet::test::FacetIndex;
|
||||
use crate::snapshot_tests::display_bitmap;
|
||||
|
||||
fn get_simple_index() -> FacetIndex<OrderedF64Codec> {
|
||||
let index = FacetIndex::<OrderedF64Codec>::new(4, 8);
|
||||
let mut txn = index.env.write_txn().unwrap();
|
||||
|
@ -1,18 +1,18 @@
|
||||
use either::Either;
|
||||
pub use filter_parser::{Condition, Error as FPError, FilterCondition, Span, Token};
|
||||
use heed::types::DecodeIgnore;
|
||||
use roaring::RoaringBitmap;
|
||||
use std::collections::HashSet;
|
||||
use std::fmt::{Debug, Display};
|
||||
use std::ops::Bound::{self, Excluded, Included};
|
||||
|
||||
use either::Either;
|
||||
pub use filter_parser::{Condition, Error as FPError, FilterCondition, Span, Token};
|
||||
use heed::types::DecodeIgnore;
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use super::facet_range_search;
|
||||
use crate::error::{Error, UserError};
|
||||
use crate::heed_codec::facet::new::ordered_f64_codec::OrderedF64Codec;
|
||||
use crate::heed_codec::facet::new::{FacetGroupValueCodec, FacetKey, FacetKeyCodec};
|
||||
use crate::{distance_between_two_points, lat_lng_to_xyz, FieldId, Index, Result};
|
||||
|
||||
use super::facet_range_search;
|
||||
|
||||
/// The maximum number of filters the filter AST can process.
|
||||
const MAX_FILTER_DEPTH: usize = 2000;
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
use heed::types::ByteSlice;
|
||||
use heed::{BytesDecode, RoTxn};
|
||||
|
||||
use crate::heed_codec::facet::new::{FacetGroupValueCodec, FacetKeyCodec, MyByteSlice};
|
||||
|
||||
pub use self::facet_distribution::{FacetDistribution, DEFAULT_VALUES_PER_FACET};
|
||||
pub use self::filter::Filter;
|
||||
use crate::heed_codec::facet::new::{FacetGroupValueCodec, FacetKeyCodec, MyByteSlice};
|
||||
|
||||
mod facet_distribution;
|
||||
mod facet_distribution_iter;
|
||||
@ -78,17 +77,18 @@ pub(crate) fn get_highest_level<'t>(
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod test {
|
||||
use crate::update::FacetsUpdateIncremental;
|
||||
use std::fmt::Display;
|
||||
use std::marker::PhantomData;
|
||||
use std::rc::Rc;
|
||||
|
||||
use heed::{BytesDecode, BytesEncode, Env, RwTxn};
|
||||
use roaring::RoaringBitmap;
|
||||
use std::{fmt::Display, marker::PhantomData, rc::Rc};
|
||||
|
||||
use crate::{
|
||||
heed_codec::facet::new::{
|
||||
FacetGroupValue, FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice,
|
||||
},
|
||||
snapshot_tests::display_bitmap,
|
||||
use crate::heed_codec::facet::new::{
|
||||
FacetGroupValue, FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice,
|
||||
};
|
||||
use crate::snapshot_tests::display_bitmap;
|
||||
use crate::update::FacetsUpdateIncremental;
|
||||
|
||||
pub struct FacetIndex<BoundCodec>
|
||||
where
|
||||
|
@ -1,10 +1,12 @@
|
||||
use crate::heed_codec::facet::new::{FacetGroupValue, FacetKey};
|
||||
use crate::{make_db_snap_from_iter, ExternalDocumentsIds, Index};
|
||||
use roaring::RoaringBitmap;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::Write;
|
||||
use std::path::Path;
|
||||
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use crate::heed_codec::facet::new::{FacetGroupValue, FacetKey};
|
||||
use crate::{make_db_snap_from_iter, ExternalDocumentsIds, Index};
|
||||
|
||||
#[track_caller]
|
||||
pub fn default_db_snapshot_settings_for_test(name: Option<&str>) -> (insta::Settings, String) {
|
||||
let mut settings = insta::Settings::clone_current();
|
||||
|
@ -1,3 +1,14 @@
|
||||
use std::cmp;
|
||||
use std::fs::File;
|
||||
use std::num::NonZeroUsize;
|
||||
|
||||
use grenad::CompressionType;
|
||||
use heed::types::ByteSlice;
|
||||
use heed::{BytesEncode, Error, RoTxn};
|
||||
use log::debug;
|
||||
use roaring::RoaringBitmap;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
use crate::error::InternalError;
|
||||
use crate::facet::FacetType;
|
||||
use crate::heed_codec::facet::new::{
|
||||
@ -5,15 +16,6 @@ use crate::heed_codec::facet::new::{
|
||||
};
|
||||
use crate::update::index_documents::{create_writer, write_into_lmdb_database, writer_into_reader};
|
||||
use crate::{FieldId, Index, Result};
|
||||
use grenad::CompressionType;
|
||||
use heed::types::ByteSlice;
|
||||
use heed::{BytesEncode, Error, RoTxn};
|
||||
use log::debug;
|
||||
use roaring::RoaringBitmap;
|
||||
use std::cmp;
|
||||
use std::fs::File;
|
||||
use std::num::NonZeroUsize;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub struct FacetsUpdateBulk<'i> {
|
||||
index: &'i Index,
|
||||
|
@ -1,11 +1,12 @@
|
||||
use heed::types::ByteSlice;
|
||||
use heed::{BytesDecode, Error, RoTxn, RwTxn};
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use crate::heed_codec::facet::new::{
|
||||
FacetGroupValue, FacetGroupValueCodec, FacetKey, FacetKeyCodec, MyByteSlice,
|
||||
};
|
||||
use crate::search::facet::get_highest_level;
|
||||
use crate::Result;
|
||||
use heed::Error;
|
||||
use heed::{types::ByteSlice, BytesDecode, RoTxn, RwTxn};
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
enum InsertionResult {
|
||||
InPlace,
|
||||
@ -462,19 +463,19 @@ impl FacetsUpdateIncremental {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::milli_snap;
|
||||
use crate::{
|
||||
heed_codec::facet::new::{
|
||||
ordered_f64_codec::OrderedF64Codec, str_ref::StrRefCodec, FacetGroupValueCodec,
|
||||
FacetKeyCodec, MyByteSlice,
|
||||
},
|
||||
search::facet::{get_highest_level, test::FacetIndex},
|
||||
};
|
||||
use heed::{types::ByteSlice, BytesDecode, BytesEncode};
|
||||
use rand::Rng;
|
||||
use rand::{seq::SliceRandom, SeedableRng};
|
||||
use heed::types::ByteSlice;
|
||||
use heed::{BytesDecode, BytesEncode};
|
||||
use rand::seq::SliceRandom;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use crate::heed_codec::facet::new::ordered_f64_codec::OrderedF64Codec;
|
||||
use crate::heed_codec::facet::new::str_ref::StrRefCodec;
|
||||
use crate::heed_codec::facet::new::{FacetGroupValueCodec, FacetKeyCodec, MyByteSlice};
|
||||
use crate::milli_snap;
|
||||
use crate::search::facet::get_highest_level;
|
||||
use crate::search::facet::test::FacetIndex;
|
||||
|
||||
pub fn verify_structure_validity<C>(index: &FacetIndex<C>, field_id: u16)
|
||||
where
|
||||
for<'a> C: BytesDecode<'a> + BytesEncode<'a, EItem = <C as BytesDecode<'a>>::DItem>,
|
||||
|
@ -1,11 +1,13 @@
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
|
||||
use heed::BytesEncode;
|
||||
|
||||
use super::helpers::{create_sorter, sorter_into_reader, try_split_array_at, GrenadParameters};
|
||||
use crate::heed_codec::facet::new::str_ref::StrRefCodec;
|
||||
use crate::heed_codec::facet::new::{FacetKey, FacetKeyCodec};
|
||||
use crate::update::index_documents::merge_cbo_roaring_bitmaps;
|
||||
use crate::{FieldId, Result};
|
||||
use heed::BytesEncode;
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
|
||||
/// Extracts the facet string and the documents ids where this facet string appear.
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user