cargo fmt

This commit is contained in:
Loïc Lecrenier
2022-09-01 11:40:29 +02:00
committed by Loïc Lecrenier
parent 36296bbb20
commit a7201ece04
12 changed files with 99 additions and 94 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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