diff --git a/meilidb-data/Cargo.toml b/meilidb-data/Cargo.toml index 18881367b..23749631b 100644 --- a/meilidb-data/Cargo.toml +++ b/meilidb-data/Cargo.toml @@ -6,6 +6,7 @@ edition = "2018" [dependencies] bincode = "1.1.2" +hashbrown = { version = "0.1.8", features = ["serde"] } linked-hash-map = { version = "0.5.2", features = ["serde_impl"] } meilidb-core = { path = "../meilidb-core", version = "0.1.0" } ordered-float = { version = "1.0.2", features = ["serde"] } diff --git a/meilidb-data/src/ranked_map.rs b/meilidb-data/src/ranked_map.rs new file mode 100644 index 000000000..7b4ff3735 --- /dev/null +++ b/meilidb-data/src/ranked_map.rs @@ -0,0 +1,5 @@ +use hashbrown::HashMap; +use meilidb_core::DocumentId; +use crate::{SchemaAttr, Number}; + +pub type RankedMap = HashMap<(DocumentId, SchemaAttr), Number>; diff --git a/meilidb/src/sort_by_attr.rs b/meilidb/src/sort_by_attr.rs index b7a1013fd..f4c4bcc41 100644 --- a/meilidb/src/sort_by_attr.rs +++ b/meilidb/src/sort_by_attr.rs @@ -4,9 +4,7 @@ use std::fmt; use meilidb_core::criterion::Criterion; use meilidb_core::RawDocument; - -use meilidb_data::{Schema, SchemaAttr}; -use meilidb_data::RankedMap; +use meilidb_data::{Schema, SchemaAttr, RankedMap}; /// An helper struct that permit to sort documents by /// some of their stored attributes.