mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +01:00
Merge pull request #162 from meilisearch/trustful-hash
Prefer using a reliable SipHash to compute document ids
This commit is contained in:
commit
71c039db09
@ -10,12 +10,13 @@ bincode = "1.1.2"
|
||||
deunicode = "1.0.0"
|
||||
hashbrown = { version = "0.2.2", features = ["serde"] }
|
||||
meilidb-core = { path = "../meilidb-core", version = "0.1.0" }
|
||||
meilidb-tokenizer = { path = "../meilidb-tokenizer", version = "0.1.0" }
|
||||
meilidb-schema = { path = "../meilidb-schema", version = "0.1.0" }
|
||||
meilidb-tokenizer = { path = "../meilidb-tokenizer", version = "0.1.0" }
|
||||
ordered-float = { version = "1.0.2", features = ["serde"] }
|
||||
rocksdb = { version = "0.12.2", default-features = false }
|
||||
sdset = "0.3.2"
|
||||
serde = { version = "1.0.91", features = ["derive"] }
|
||||
rocksdb = { version = "0.12.2", default-features = false }
|
||||
siphasher = "0.3.0"
|
||||
zerocopy = "0.2.2"
|
||||
|
||||
[dependencies.rmp-serde]
|
||||
|
@ -1,9 +1,8 @@
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
use meilidb_core::DocumentId;
|
||||
use serde::Serialize;
|
||||
use serde::ser;
|
||||
use serde::{ser, Serialize};
|
||||
use siphasher::sip::SipHasher;
|
||||
|
||||
use super::{SerializerError, ConvertToString};
|
||||
|
||||
@ -18,7 +17,7 @@ where D: serde::Serialize,
|
||||
}
|
||||
|
||||
fn calculate_hash<T: Hash>(t: &T) -> u64 {
|
||||
let mut s = DefaultHasher::new();
|
||||
let mut s = SipHasher::new();
|
||||
t.hash(&mut s);
|
||||
s.finish()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user