diff --git a/src/automaton/mod.rs b/src/automaton/mod.rs index 8c5c68d98..79422c1ff 100644 --- a/src/automaton/mod.rs +++ b/src/automaton/mod.rs @@ -22,7 +22,7 @@ pub struct AutomatonProducer { impl AutomatonProducer { pub fn new( - reader: &rkv::Reader, + reader: &impl rkv::Readable, query: &str, synonyms_store: store::Synonyms, ) -> (AutomatonProducer, QueryEnhancer) @@ -99,7 +99,7 @@ pub fn normalize_str(string: &str) -> String { } fn generate_automatons( - reader: &rkv::Reader, + reader: &impl rkv::Readable, query: &str, synonym_store: store::Synonyms, ) -> Result<(Vec>, QueryEnhancer), rkv::StoreError> diff --git a/src/lib.rs b/src/lib.rs index 99f85dcb1..f917f652b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,8 +21,6 @@ use self::ranked_map::RankedMap; use zerocopy::{AsBytes, FromBytes}; use ::serde::{Serialize, Deserialize}; -pub type BEI64 = zerocopy::I64; - /// Represent an internally generated document unique identifier. /// /// It is used to inform the database the document you want to deserialize. diff --git a/src/query_builder.rs b/src/query_builder.rs index d91ec94f5..b488d17b0 100644 --- a/src/query_builder.rs +++ b/src/query_builder.rs @@ -119,7 +119,7 @@ fn multiword_rewrite_matches( } fn fetch_raw_documents( - reader: &rkv::Reader, + reader: &impl rkv::Readable, automatons: &[Automaton], query_enhancer: &QueryEnhancer, searchables: Option<&ReorderedAttrs>, @@ -203,7 +203,7 @@ impl<'a> QueryBuilder<'a> { pub fn query( self, - reader: &rkv::Reader, + reader: &impl rkv::Readable, query: &str, range: Range, ) -> MResult> diff --git a/src/store/documents_fields.rs b/src/store/documents_fields.rs index 6a80f7e0f..592d171e7 100644 --- a/src/store/documents_fields.rs +++ b/src/store/documents_fields.rs @@ -63,9 +63,9 @@ impl DocumentsFields { Ok(count) } - pub fn document_field<'a, T: rkv::Readable>( + pub fn document_field<'a>( &self, - reader: &'a T, + reader: &'a impl rkv::Readable, document_id: DocumentId, attribute: SchemaAttr, ) -> Result, rkv::StoreError> diff --git a/src/store/main.rs b/src/store/main.rs index a2cace7fe..8011e0e7d 100644 --- a/src/store/main.rs +++ b/src/store/main.rs @@ -26,9 +26,9 @@ impl Main { self.main.put(writer, WORDS_KEY, &blob) } - pub fn words_fst( + pub fn words_fst( &self, - reader: &T, + reader: &impl rkv::Readable, ) -> MResult> { match self.main.get(reader, WORDS_KEY)? { @@ -56,9 +56,9 @@ impl Main { Ok(()) } - pub fn ranked_map( + pub fn ranked_map( &self, - reader: &T, + reader: &impl rkv::Readable, ) -> MResult> { match self.main.get(reader, RANKED_MAP_KEY)? { @@ -82,9 +82,9 @@ impl Main { Ok(new) } - pub fn number_of_documents( + pub fn number_of_documents( &self, - reader: &T, + reader: &impl rkv::Readable, ) -> Result { match self.main.get(reader, NUMBER_OF_DOCUMENTS_KEY)? { diff --git a/src/store/postings_lists.rs b/src/store/postings_lists.rs index 3af7077c0..b66ec3fb3 100644 --- a/src/store/postings_lists.rs +++ b/src/store/postings_lists.rs @@ -31,9 +31,9 @@ impl PostingsLists { self.postings_lists.delete(writer, word) } - pub fn postings_list<'a, T: rkv::Readable>( + pub fn postings_list<'a>( &self, - reader: &'a T, + reader: &'a impl rkv::Readable, word: &[u8], ) -> Result>>, rkv::StoreError> { diff --git a/src/store/synonyms.rs b/src/store/synonyms.rs index d605de35a..e254420d8 100644 --- a/src/store/synonyms.rs +++ b/src/store/synonyms.rs @@ -4,17 +4,17 @@ pub struct Synonyms { } impl Synonyms { - pub fn synonyms_fst( + pub fn synonyms_fst( &self, - reader: &T, + reader: &impl rkv::Readable, ) -> Result { Ok(fst::Set::default()) } - pub fn alternatives_to( + pub fn alternatives_to( &self, - reader: &T, + reader: &impl rkv::Readable, word: &[u8], ) -> Result, rkv::StoreError> { diff --git a/src/store/updates.rs b/src/store/updates.rs index 21264cc5e..e6f6f0786 100644 --- a/src/store/updates.rs +++ b/src/store/updates.rs @@ -10,9 +10,9 @@ pub struct Updates { impl Updates { // TODO we should use the MDB_LAST op but // it is not exposed by the rkv library - fn last_update_id<'a, T: rkv::Readable>( + fn last_update_id<'a>( &self, - reader: &'a T, + reader: &'a impl rkv::Readable, ) -> Result>)>, rkv::StoreError> { let mut last = None; @@ -33,9 +33,9 @@ impl Updates { Ok(Some((number, last_data))) } - pub fn contains( + pub fn contains( &self, - reader: &T, + reader: &impl rkv::Readable, update_id: u64, ) -> Result { diff --git a/src/store/updates_results.rs b/src/store/updates_results.rs index 527d7d376..8fe0ccb9f 100644 --- a/src/store/updates_results.rs +++ b/src/store/updates_results.rs @@ -21,9 +21,9 @@ impl UpdatesResults { Ok(()) } - pub fn update_result( + pub fn update_result( &self, - reader: &T, + reader: &impl rkv::Readable, update_id: u64, ) -> MResult> {