test: Add a raptor-search bench

This commit is contained in:
Kerollmops 2018-06-24 15:10:13 +02:00 committed by Clément Renault
parent 879e28fb7d
commit 8fab80048c
4 changed files with 48 additions and 8 deletions

View file

@ -9,6 +9,9 @@ pub mod map;
pub mod rank;
mod levenshtein;
use std::path::Path;
use std::fs;
pub use self::map::{Map, MapBuilder, Values};
pub use self::map::{
OpBuilder, IndexedValues,
@ -101,3 +104,12 @@ impl Match {
}
}
}
pub fn load_map<P, Q>(map: P, values: Q) -> fst::Result<DocIndexMap>
where P: AsRef<Path>, Q: AsRef<Path>,
{
let fst = fs::read(map)?;
let values = fs::read(values)?;
DocIndexMap::from_bytes(fst, &values)
}

View file

@ -334,7 +334,7 @@ impl<'m, 'v, 'a> fst::Streamer<'a> for RankedStream<'m, 'v> {
// TODO remove the Pool system !
// this is an internal Pool rule but
// it is more efficient to test that here
if pool.limitation.reached().is_some() && distance != 0 { continue }
if pool.limitation.is_reached() && distance != 0 { continue }
let mut matches = HashMap::with_capacity(iv.values.len() / 2);
for di in iv.values {