mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
clippy + fmt
This commit is contained in:
parent
b000ae7614
commit
834995b130
13 changed files with 78 additions and 53 deletions
|
@ -3,7 +3,7 @@ use std::io::{BufRead, BufReader, Write};
|
|||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::{Context, bail};
|
||||
use anyhow::{bail, Context};
|
||||
use heed::RoTxn;
|
||||
use indexmap::IndexMap;
|
||||
use milli::update::{IndexDocumentsMethod, UpdateFormat::JsonStream};
|
||||
|
|
|
@ -13,7 +13,7 @@ use serde_json::{Map, Value};
|
|||
use crate::helpers::EnvSizer;
|
||||
use error::Result;
|
||||
|
||||
pub use search::{SearchQuery, SearchResult, DEFAULT_SEARCH_LIMIT, default_crop_length};
|
||||
pub use search::{default_crop_length, SearchQuery, SearchResult, DEFAULT_SEARCH_LIMIT};
|
||||
pub use updates::{Checked, Facets, Settings, Unchecked};
|
||||
|
||||
use self::error::IndexError;
|
||||
|
|
|
@ -233,8 +233,8 @@ impl Index {
|
|||
fn compute_matches<A: AsRef<[u8]>>(
|
||||
matcher: &impl Matcher,
|
||||
document: &Document,
|
||||
analyzer: &Analyzer<A>
|
||||
) -> MatchesInfo {
|
||||
analyzer: &Analyzer<A>,
|
||||
) -> MatchesInfo {
|
||||
let mut matches = BTreeMap::new();
|
||||
|
||||
for (key, value) in document {
|
||||
|
@ -1174,6 +1174,9 @@ mod test {
|
|||
let analyzer = Analyzer::new(config);
|
||||
|
||||
let matches = compute_matches(&matcher, &value, &analyzer);
|
||||
assert_eq!(format!("{:?}", matches), r##"{"about": [MatchInfo { start: 0, length: 6 }, MatchInfo { start: 31, length: 7 }, MatchInfo { start: 191, length: 7 }, MatchInfo { start: 225, length: 7 }, MatchInfo { start: 233, length: 6 }], "color": [MatchInfo { start: 0, length: 3 }]}"##);
|
||||
assert_eq!(
|
||||
format!("{:?}", matches),
|
||||
r##"{"about": [MatchInfo { start: 0, length: 6 }, MatchInfo { start: 31, length: 7 }, MatchInfo { start: 191, length: 7 }, MatchInfo { start: 225, length: 7 }, MatchInfo { start: 233, length: 6 }], "color": [MatchInfo { start: 0, length: 3 }]}"##
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue