Cargo fmt

This commit is contained in:
Loïc Lecrenier 2023-03-19 15:15:58 +01:00
parent a59ca28e2c
commit fbb1ba3de0
7 changed files with 19 additions and 29 deletions

View File

@ -70,10 +70,6 @@ pub mod update;
#[macro_use] #[macro_use]
pub mod snapshot_tests; pub mod snapshot_tests;
pub use search::new::DetailedSearchLogger;
pub use search::new::{execute_search, DefaultSearchLogger, SearchContext};
use std::collections::{BTreeMap, HashMap}; use std::collections::{BTreeMap, HashMap};
use std::convert::{TryFrom, TryInto}; use std::convert::{TryFrom, TryInto};
use std::hash::BuildHasherDefault; use std::hash::BuildHasherDefault;
@ -81,6 +77,7 @@ use std::hash::BuildHasherDefault;
pub use filter_parser::{Condition, FilterCondition, Span, Token}; pub use filter_parser::{Condition, FilterCondition, Span, Token};
use fxhash::{FxHasher32, FxHasher64}; use fxhash::{FxHasher32, FxHasher64};
pub use grenad::CompressionType; pub use grenad::CompressionType;
pub use search::new::{execute_search, DefaultSearchLogger, DetailedSearchLogger, SearchContext};
use serde_json::Value; use serde_json::Value;
pub use {charabia as tokenizer, heed}; pub use {charabia as tokenizer, heed};

View File

@ -1,19 +1,15 @@
use heed::{ use heed::types::{ByteSlice, Str, Unit};
types::{ByteSlice, Str, Unit}, use heed::{Database, RoPrefix, RoTxn};
Database, RoPrefix, RoTxn,
};
use roaring::RoaringBitmap; use roaring::RoaringBitmap;
const FID_SIZE: usize = 2; const FID_SIZE: usize = 2;
const DOCID_SIZE: usize = 4; const DOCID_SIZE: usize = 4;
use crate::{ use crate::heed_codec::facet::{
heed_codec::{ FacetGroupKey, FacetGroupKeyCodec, FacetGroupValueCodec, FieldDocIdFacetCodec,
facet::{FacetGroupKey, FacetGroupKeyCodec, FacetGroupValueCodec, FieldDocIdFacetCodec},
ByteSliceRefCodec,
},
Index, Result, SearchContext,
}; };
use crate::heed_codec::ByteSliceRefCodec;
use crate::{Index, Result, SearchContext};
pub struct DistinctOutput { pub struct DistinctOutput {
pub remaining: RoaringBitmap, pub remaining: RoaringBitmap,

View File

@ -13,9 +13,7 @@ use crate::search::new::ranking_rule_graph::{
DeadEndsCache, Edge, ProximityCondition, ProximityGraph, RankingRuleGraph, DeadEndsCache, Edge, ProximityCondition, ProximityGraph, RankingRuleGraph,
RankingRuleGraphTrait, TypoCondition, TypoGraph, RankingRuleGraphTrait, TypoCondition, TypoGraph,
}; };
use crate::search::new::small_bitmap::SmallBitmap; use crate::search::new::{QueryGraph, QueryNode, RankingRule, SearchContext, SearchLogger};
use crate::search::new::{QueryGraph, QueryNode, SearchContext};
use crate::search::new::{RankingRule, SearchLogger};
pub enum SearchEvents { pub enum SearchEvents {
RankingRuleStartIteration { RankingRuleStartIteration {

View File

@ -16,17 +16,15 @@ mod sort;
mod words; mod words;
// #[cfg(test)] // #[cfg(test)]
pub use logger::detailed::DetailedSearchLogger;
pub use logger::{DefaultSearchLogger, SearchLogger};
use std::collections::{BTreeSet, HashSet}; use std::collections::{BTreeSet, HashSet};
use crate::{Filter, Index, MatchingWords, Result, Search, SearchResult, TermsMatchingStrategy};
use charabia::Tokenize; use charabia::Tokenize;
use db_cache::DatabaseCache; use db_cache::DatabaseCache;
use graph_based_ranking_rule::{Proximity, Typo}; use graph_based_ranking_rule::{Proximity, Typo};
use heed::RoTxn; use heed::RoTxn;
use interner::DedupInterner; use interner::DedupInterner;
pub use logger::detailed::DetailedSearchLogger;
pub use logger::{DefaultSearchLogger, SearchLogger};
use query_graph::{QueryGraph, QueryNode, QueryNodeData}; use query_graph::{QueryGraph, QueryNode, QueryNodeData};
use query_term::{located_query_terms_from_string, Phrase, QueryTerm}; use query_term::{located_query_terms_from_string, Phrase, QueryTerm};
use ranking_rules::{bucket_sort, PlaceholderQuery, RankingRuleOutput, RankingRuleQueryTrait}; use ranking_rules::{bucket_sort, PlaceholderQuery, RankingRuleOutput, RankingRuleQueryTrait};
@ -35,6 +33,7 @@ use roaring::RoaringBitmap;
use words::Words; use words::Words;
use self::ranking_rules::RankingRule; use self::ranking_rules::RankingRule;
use crate::{Filter, Index, MatchingWords, Result, Search, SearchResult, TermsMatchingStrategy};
/// A structure used throughout the execution of a search query. /// A structure used throughout the execution of a search query.
pub struct SearchContext<'ctx> { pub struct SearchContext<'ctx> {

View File

@ -1,7 +1,5 @@
use crate::search::new::{ use crate::search::new::interner::{FixedSizeInterner, Interned};
interner::{FixedSizeInterner, Interned}, use crate::search::new::small_bitmap::SmallBitmap;
small_bitmap::SmallBitmap,
};
pub struct DeadEndsCache<T> { pub struct DeadEndsCache<T> {
conditions: Vec<Interned<T>>, conditions: Vec<Interned<T>>,

View File

@ -1,6 +1,8 @@
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
use std::collections::BTreeMap; use std::collections::BTreeMap;
use heed::RoTxn;
use super::ProximityCondition; use super::ProximityCondition;
use crate::search::new::db_cache::DatabaseCache; use crate::search::new::db_cache::DatabaseCache;
use crate::search::new::interner::{DedupInterner, Interned}; use crate::search::new::interner::{DedupInterner, Interned};
@ -9,7 +11,6 @@ use crate::search::new::query_term::{LocatedQueryTerm, Phrase, QueryTerm};
use crate::search::new::ranking_rule_graph::proximity::WordPair; use crate::search::new::ranking_rule_graph::proximity::WordPair;
use crate::search::new::{QueryNode, SearchContext}; use crate::search::new::{QueryNode, SearchContext};
use crate::Result; use crate::Result;
use heed::RoTxn;
fn last_word_of_term_iter<'t>( fn last_word_of_term_iter<'t>(
t: &'t QueryTerm, t: &'t QueryTerm,

View File

@ -1,3 +1,7 @@
use std::collections::HashSet;
use std::fmt::Write;
use std::iter::FromIterator;
use roaring::RoaringBitmap; use roaring::RoaringBitmap;
use super::{DeadEndsCache, RankingRuleGraph, RankingRuleGraphTrait}; use super::{DeadEndsCache, RankingRuleGraph, RankingRuleGraphTrait};
@ -7,9 +11,6 @@ use crate::search::new::query_graph::QueryNodeData;
use crate::search::new::query_term::{LocatedQueryTerm, Phrase, QueryTerm}; use crate::search::new::query_term::{LocatedQueryTerm, Phrase, QueryTerm};
use crate::search::new::{QueryGraph, QueryNode, SearchContext}; use crate::search::new::{QueryGraph, QueryNode, SearchContext};
use crate::Result; use crate::Result;
use std::collections::HashSet;
use std::fmt::Write;
use std::iter::FromIterator;
#[derive(Clone, PartialEq, Eq, Hash)] #[derive(Clone, PartialEq, Eq, Hash)]
pub struct TypoCondition { pub struct TypoCondition {