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)
}