mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Merge pull request #164 from meilisearch/clippy-fixes
Make clippy happy
This commit is contained in:
commit
3bcc1c0560
@ -381,7 +381,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => wtxn.commit().map_err(Into::into),
|
Ok(_) => wtxn.commit().map_err(Into::into),
|
||||||
Err(e) => Err(e.into())
|
Err(e) => Err(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateMeta::ClearDocuments => {
|
UpdateMeta::ClearDocuments => {
|
||||||
@ -391,7 +391,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
match builder.execute() {
|
match builder.execute() {
|
||||||
Ok(_count) => wtxn.commit().map_err(Into::into),
|
Ok(_count) => wtxn.commit().map_err(Into::into),
|
||||||
Err(e) => Err(e.into())
|
Err(e) => Err(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateMeta::Settings(settings) => {
|
UpdateMeta::Settings(settings) => {
|
||||||
@ -461,7 +461,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(_count) => wtxn.commit().map_err(Into::into),
|
Ok(_count) => wtxn.commit().map_err(Into::into),
|
||||||
Err(e) => Err(e.into())
|
Err(e) => Err(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateMeta::Facets(levels) => {
|
UpdateMeta::Facets(levels) => {
|
||||||
@ -476,7 +476,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
match builder.execute() {
|
match builder.execute() {
|
||||||
Ok(()) => wtxn.commit().map_err(Into::into),
|
Ok(()) => wtxn.commit().map_err(Into::into),
|
||||||
Err(e) => Err(e.into())
|
Err(e) => Err(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateMeta::WordsPrefixes(settings) => {
|
UpdateMeta::WordsPrefixes(settings) => {
|
||||||
@ -491,7 +491,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
match builder.execute() {
|
match builder.execute() {
|
||||||
Ok(()) => wtxn.commit().map_err(Into::into),
|
Ok(()) => wtxn.commit().map_err(Into::into),
|
||||||
Err(e) => Err(e.into())
|
Err(e) => Err(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1001,7 +1001,8 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
.or(update_ws_route);
|
.or(update_ws_route);
|
||||||
|
|
||||||
let addr = SocketAddr::from_str(&opt.http_listen_addr)?;
|
let addr = SocketAddr::from_str(&opt.http_listen_addr)?;
|
||||||
Ok(warp::serve(routes).run(addr).await)
|
warp::serve(routes).run(addr).await;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -10,6 +10,8 @@ use crate::search::query_tree::{maximum_proximity, Operation, Query};
|
|||||||
use crate::search::{build_dfa, WordDerivationsCache};
|
use crate::search::{build_dfa, WordDerivationsCache};
|
||||||
use super::{Candidates, Criterion, CriterionResult, Context, query_docids, query_pair_proximity_docids, resolve_query_tree};
|
use super::{Candidates, Criterion, CriterionResult, Context, query_docids, query_pair_proximity_docids, resolve_query_tree};
|
||||||
|
|
||||||
|
type Cache = HashMap<(Operation, u8), Vec<(Query, Query, RoaringBitmap)>>;
|
||||||
|
|
||||||
pub struct Proximity<'t> {
|
pub struct Proximity<'t> {
|
||||||
ctx: &'t dyn Context,
|
ctx: &'t dyn Context,
|
||||||
query_tree: Option<(usize, Operation)>,
|
query_tree: Option<(usize, Operation)>,
|
||||||
@ -17,7 +19,7 @@ pub struct Proximity<'t> {
|
|||||||
candidates: Candidates,
|
candidates: Candidates,
|
||||||
bucket_candidates: RoaringBitmap,
|
bucket_candidates: RoaringBitmap,
|
||||||
parent: Option<Box<dyn Criterion + 't>>,
|
parent: Option<Box<dyn Criterion + 't>>,
|
||||||
candidates_cache: HashMap<(Operation, u8), Vec<(Query, Query, RoaringBitmap)>>,
|
candidates_cache: Cache,
|
||||||
plane_sweep_cache: Option<btree_map::IntoIter<u8, RoaringBitmap>>,
|
plane_sweep_cache: Option<btree_map::IntoIter<u8, RoaringBitmap>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ impl<'t> Proximity<'t> {
|
|||||||
candidates: candidates.map_or_else(Candidates::default, Candidates::Allowed),
|
candidates: candidates.map_or_else(Candidates::default, Candidates::Allowed),
|
||||||
bucket_candidates: RoaringBitmap::new(),
|
bucket_candidates: RoaringBitmap::new(),
|
||||||
parent: None,
|
parent: None,
|
||||||
candidates_cache: HashMap::new(),
|
candidates_cache: Cache::new(),
|
||||||
plane_sweep_cache: None,
|
plane_sweep_cache: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,7 +50,7 @@ impl<'t> Proximity<'t> {
|
|||||||
candidates: Candidates::default(),
|
candidates: Candidates::default(),
|
||||||
bucket_candidates: RoaringBitmap::new(),
|
bucket_candidates: RoaringBitmap::new(),
|
||||||
parent: Some(parent),
|
parent: Some(parent),
|
||||||
candidates_cache: HashMap::new(),
|
candidates_cache: Cache::new(),
|
||||||
plane_sweep_cache: None,
|
plane_sweep_cache: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,7 +206,7 @@ fn resolve_candidates<'t>(
|
|||||||
ctx: &'t dyn Context,
|
ctx: &'t dyn Context,
|
||||||
query_tree: &Operation,
|
query_tree: &Operation,
|
||||||
proximity: u8,
|
proximity: u8,
|
||||||
cache: &mut HashMap<(Operation, u8), Vec<(Query, Query, RoaringBitmap)>>,
|
cache: &mut Cache,
|
||||||
wdcache: &mut WordDerivationsCache,
|
wdcache: &mut WordDerivationsCache,
|
||||||
) -> anyhow::Result<RoaringBitmap>
|
) -> anyhow::Result<RoaringBitmap>
|
||||||
{
|
{
|
||||||
@ -212,7 +214,7 @@ fn resolve_candidates<'t>(
|
|||||||
ctx: &'t dyn Context,
|
ctx: &'t dyn Context,
|
||||||
query_tree: &Operation,
|
query_tree: &Operation,
|
||||||
proximity: u8,
|
proximity: u8,
|
||||||
cache: &mut HashMap<(Operation, u8), Vec<(Query, Query, RoaringBitmap)>>,
|
cache: &mut Cache,
|
||||||
wdcache: &mut WordDerivationsCache,
|
wdcache: &mut WordDerivationsCache,
|
||||||
) -> anyhow::Result<Vec<(Query, Query, RoaringBitmap)>>
|
) -> anyhow::Result<Vec<(Query, Query, RoaringBitmap)>>
|
||||||
{
|
{
|
||||||
@ -249,7 +251,7 @@ fn resolve_candidates<'t>(
|
|||||||
left: &Operation,
|
left: &Operation,
|
||||||
right: &Operation,
|
right: &Operation,
|
||||||
proximity: u8,
|
proximity: u8,
|
||||||
cache: &mut HashMap<(Operation, u8), Vec<(Query, Query, RoaringBitmap)>>,
|
cache: &mut Cache,
|
||||||
wdcache: &mut WordDerivationsCache,
|
wdcache: &mut WordDerivationsCache,
|
||||||
) -> anyhow::Result<Vec<(Query, Query, RoaringBitmap)>>
|
) -> anyhow::Result<Vec<(Query, Query, RoaringBitmap)>>
|
||||||
{
|
{
|
||||||
@ -303,7 +305,7 @@ fn resolve_candidates<'t>(
|
|||||||
ctx: &'t dyn Context,
|
ctx: &'t dyn Context,
|
||||||
branches: &[Operation],
|
branches: &[Operation],
|
||||||
proximity: u8,
|
proximity: u8,
|
||||||
cache: &mut HashMap<(Operation, u8), Vec<(Query, Query, RoaringBitmap)>>,
|
cache: &mut Cache,
|
||||||
wdcache: &mut WordDerivationsCache,
|
wdcache: &mut WordDerivationsCache,
|
||||||
) -> anyhow::Result<Vec<(Query, Query, RoaringBitmap)>>
|
) -> anyhow::Result<Vec<(Query, Query, RoaringBitmap)>>
|
||||||
{
|
{
|
||||||
@ -332,7 +334,7 @@ fn resolve_candidates<'t>(
|
|||||||
Ok(output)
|
Ok(output)
|
||||||
},
|
},
|
||||||
Some((head1, None)) => resolve_operation(ctx, head1, proximity, cache, wdcache),
|
Some((head1, None)) => resolve_operation(ctx, head1, proximity, cache, wdcache),
|
||||||
None => return Ok(Default::default()),
|
None => Ok(Default::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,10 +507,8 @@ fn resolve_plane_sweep_candidates(
|
|||||||
let iter = word_derivations(word, true, 0, &words_positions)
|
let iter = word_derivations(word, true, 0, &words_positions)
|
||||||
.flat_map(|positions| positions.iter().map(|p| (p, 0, p)));
|
.flat_map(|positions| positions.iter().map(|p| (p, 0, p)));
|
||||||
result.extend(iter);
|
result.extend(iter);
|
||||||
} else {
|
} else if let Some(positions) = words_positions.get(word) {
|
||||||
if let Some(positions) = words_positions.get(word) {
|
|
||||||
result.extend(positions.iter().map(|p| (p, 0, p)));
|
result.extend(positions.iter().map(|p| (p, 0, p)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
QueryKind::Tolerant { typo, word } => {
|
QueryKind::Tolerant { typo, word } => {
|
||||||
|
Loading…
Reference in New Issue
Block a user