feat: Create a strong DocumentId type

Forcing it to be something internal will permit to avoid possible miss comparisons to be done with other types.
This commit is contained in:
Clément Renault
2018-12-22 12:00:24 +01:00
parent a756ca5e3f
commit 4ebae7784c
9 changed files with 46 additions and 29 deletions

View File

@ -11,7 +11,12 @@ pub use rocksdb;
pub use self::tokenizer::Tokenizer;
pub use self::common_words::CommonWords;
pub type DocumentId = u64;
/// Represent an internally generated document unique identifier.
///
/// It is used to inform the database the document you want to deserialize.
/// Helpful for custom ranking.
#[derive(Debug, Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Hash)]
pub struct DocumentId(pub u64);
/// This structure represent the position of a word
/// in a document and its attributes.