Cargo fmt

This commit is contained in:
Louis Dureuil 2023-05-03 12:21:58 +02:00
parent 90bc230820
commit 1aaf24ccbf
No known key found for this signature in database
18 changed files with 48 additions and 55 deletions

View File

@ -21,5 +21,5 @@ pub use self::roaring_bitmap_length::{
BoRoaringBitmapLenCodec, CboRoaringBitmapLenCodec, RoaringBitmapLenCodec, BoRoaringBitmapLenCodec, CboRoaringBitmapLenCodec, RoaringBitmapLenCodec,
}; };
pub use self::script_language_codec::ScriptLanguageCodec; pub use self::script_language_codec::ScriptLanguageCodec;
pub use self::str_beu32_codec::{StrBEU32Codec, StrBEU16Codec}; pub use self::str_beu32_codec::{StrBEU16Codec, StrBEU32Codec};
pub use self::str_str_u8_codec::{U8StrStrCodec, UncheckedU8StrStrCodec}; pub use self::str_str_u8_codec::{U8StrStrCodec, UncheckedU8StrStrCodec};

View File

@ -1,3 +1,9 @@
use std::cmp::Ordering;
use std::collections::BTreeMap;
use std::hash::{Hash, Hasher};
use fxhash::{FxHashMap, FxHasher};
use super::interner::{FixedSizeInterner, Interned}; use super::interner::{FixedSizeInterner, Interned};
use super::query_term::{ use super::query_term::{
self, number_of_typos_allowed, LocatedQueryTerm, LocatedQueryTermSubset, QueryTermSubset, self, number_of_typos_allowed, LocatedQueryTerm, LocatedQueryTermSubset, QueryTermSubset,
@ -6,10 +12,6 @@ use super::small_bitmap::SmallBitmap;
use super::SearchContext; use super::SearchContext;
use crate::search::new::interner::Interner; use crate::search::new::interner::Interner;
use crate::Result; use crate::Result;
use fxhash::{FxHashMap, FxHasher};
use std::cmp::Ordering;
use std::collections::BTreeMap;
use std::hash::{Hash, Hasher};
/// A node of the [`QueryGraph`]. /// A node of the [`QueryGraph`].
/// ///

View File

@ -1,8 +1,7 @@
use std::collections::BTreeSet; use std::collections::BTreeSet;
use crate::search::new::interner::Interned;
use super::Phrase; use super::Phrase;
use crate::search::new::interner::Interned;
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum NTypoTermSubset { pub enum NTypoTermSubset {

View File

@ -1,6 +1,7 @@
use itertools::Itertools; use itertools::Itertools;
use crate::{search::new::interner::Interned, SearchContext}; use crate::search::new::interner::Interned;
use crate::SearchContext;
/// A phrase in the user's search query, consisting of several words /// A phrase in the user's search query, consisting of several words
/// that must appear side-by-side in the search results. /// that must appear side-by-side in the search results.

View File

@ -1,10 +1,11 @@
use std::collections::HashSet;
use super::{Edge, RankingRuleGraph, RankingRuleGraphTrait}; use super::{Edge, RankingRuleGraph, RankingRuleGraphTrait};
use crate::search::new::interner::{DedupInterner, MappedInterner}; use crate::search::new::interner::{DedupInterner, MappedInterner};
use crate::search::new::query_graph::{QueryNode, QueryNodeData}; use crate::search::new::query_graph::{QueryNode, QueryNodeData};
use crate::search::new::small_bitmap::SmallBitmap; use crate::search::new::small_bitmap::SmallBitmap;
use crate::search::new::{QueryGraph, SearchContext}; use crate::search::new::{QueryGraph, SearchContext};
use crate::Result; use crate::Result;
use std::collections::HashSet;
impl<G: RankingRuleGraphTrait> RankingRuleGraph<G> { impl<G: RankingRuleGraphTrait> RankingRuleGraph<G> {
/// Build the ranking rule graph from the given query graph /// Build the ranking rule graph from the given query graph

View File

@ -1,4 +1,5 @@
use crate::{index::tests::TempIndex, Criterion, Search, SearchResult, TermsMatchingStrategy}; use crate::index::tests::TempIndex;
use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -1,6 +1,5 @@
use crate::{ use crate::index::tests::TempIndex;
db_snap, index::tests::TempIndex, Criterion, Search, SearchResult, TermsMatchingStrategy, use crate::{db_snap, Criterion, Search, SearchResult, TermsMatchingStrategy};
};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -17,12 +17,9 @@ use big_s::S;
use heed::RoTxn; use heed::RoTxn;
use maplit::hashset; use maplit::hashset;
use crate::{
index::tests::TempIndex, AscDesc, Criterion, Index, Member, Search, SearchResult,
TermsMatchingStrategy,
};
use super::collect_field_values; use super::collect_field_values;
use crate::index::tests::TempIndex;
use crate::{AscDesc, Criterion, Index, Member, Search, SearchResult, TermsMatchingStrategy};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -19,10 +19,9 @@ Then these rules will only work with
2. the full query term otherwise 2. the full query term otherwise
*/ */
use crate::{ use crate::index::tests::TempIndex;
index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, use crate::search::new::tests::collect_field_values;
SearchResult, TermsMatchingStrategy, use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy};
};
fn create_index_simple_ordered() -> TempIndex { fn create_index_simple_ordered() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -4,12 +4,9 @@ use big_s::S;
use heed::EnvOpenOptions; use heed::EnvOpenOptions;
use maplit::{hashmap, hashset}; use maplit::{hashmap, hashset};
use crate::{ use crate::documents::{DocumentsBatchBuilder, DocumentsBatchReader};
db_snap, use crate::update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig, Settings};
documents::{DocumentsBatchBuilder, DocumentsBatchReader}, use crate::{db_snap, Criterion, Index, Object};
update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig, Settings},
Criterion, Index, Object,
};
pub const CONTENT: &str = include_str!("../../../../tests/assets/test_set.ndjson"); pub const CONTENT: &str = include_str!("../../../../tests/assets/test_set.ndjson");
pub fn setup_search_index_with_criteria(criteria: &[Criterion]) -> Index { pub fn setup_search_index_with_criteria(criteria: &[Criterion]) -> Index {

View File

@ -1,4 +1,5 @@
use crate::{index::tests::TempIndex, Search, SearchResult}; use crate::index::tests::TempIndex;
use crate::{Search, SearchResult};
#[test] #[test]
fn test_kanji_language_detection() { fn test_kanji_language_detection() {

View File

@ -16,10 +16,9 @@ This module tests the following properties:
13. Ngrams cannot be formed by combining a phrase and a word or two phrases 13. Ngrams cannot be formed by combining a phrase and a word or two phrases
*/ */
use crate::{ use crate::index::tests::TempIndex;
index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, use crate::search::new::tests::collect_field_values;
SearchResult, TermsMatchingStrategy, use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy};
};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -17,10 +17,9 @@ they store fewer sprximities than the regular word sprximity DB.
use std::collections::HashMap; use std::collections::HashMap;
use crate::{ use crate::index::tests::TempIndex;
index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, use crate::search::new::tests::collect_field_values;
SearchResult, TermsMatchingStrategy, use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy};
};
fn create_simple_index() -> TempIndex { fn create_simple_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -7,10 +7,9 @@ only contains the word pairs that it used to compute its bucket.
TODO: This is not currently implemented. TODO: This is not currently implemented.
*/ */
use crate::{ use crate::index::tests::TempIndex;
index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, use crate::search::new::tests::collect_field_values;
SearchResult, TermsMatchingStrategy, use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy};
};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -14,10 +14,9 @@ This module tests the `sort` ranking rule:
use big_s::S; use big_s::S;
use maplit::hashset; use maplit::hashset;
use crate::{ use crate::index::tests::TempIndex;
index::tests::TempIndex, search::new::tests::collect_field_values, AscDesc, Criterion, Member, use crate::search::new::tests::collect_field_values;
Search, SearchResult, TermsMatchingStrategy, use crate::{AscDesc, Criterion, Member, Search, SearchResult, TermsMatchingStrategy};
};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -9,9 +9,11 @@ This module tests the following properties about stop words:
- Phrases consisting only of stop words are ignored - Phrases consisting only of stop words are ignored
*/ */
use std::{collections::BTreeSet, iter::FromIterator}; use std::collections::BTreeSet;
use std::iter::FromIterator;
use crate::{db_snap, index::tests::TempIndex, Search, SearchResult, TermsMatchingStrategy}; use crate::index::tests::TempIndex;
use crate::{db_snap, Search, SearchResult, TermsMatchingStrategy};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -15,10 +15,9 @@ The proximity ranking rule is not allowed to look for the proximity between `bea
because the typo ranking rule before it only used the derivation `beautiful`. because the typo ranking rule before it only used the derivation `beautiful`.
*/ */
use crate::{ use crate::index::tests::TempIndex;
index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, use crate::search::new::tests::collect_field_values;
SearchResult, TermsMatchingStrategy, use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy};
};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();

View File

@ -12,10 +12,9 @@ account by the proximity ranking rule.
7. The search is capable of returning no results if no documents match the query 7. The search is capable of returning no results if no documents match the query
*/ */
use crate::{ use crate::index::tests::TempIndex;
index::tests::TempIndex, search::new::tests::collect_field_values, Criterion, Search, use crate::search::new::tests::collect_field_values;
SearchResult, TermsMatchingStrategy, use crate::{Criterion, Search, SearchResult, TermsMatchingStrategy};
};
fn create_index() -> TempIndex { fn create_index() -> TempIndex {
let index = TempIndex::new(); let index = TempIndex::new();