mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
Prefer using the impl syntax
This commit is contained in:
parent
38e474deaf
commit
3476939b7e
@ -22,7 +22,7 @@ pub struct AutomatonProducer {
|
|||||||
|
|
||||||
impl AutomatonProducer {
|
impl AutomatonProducer {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
reader: &rkv::Reader,
|
reader: &impl rkv::Readable,
|
||||||
query: &str,
|
query: &str,
|
||||||
synonyms_store: store::Synonyms,
|
synonyms_store: store::Synonyms,
|
||||||
) -> (AutomatonProducer, QueryEnhancer)
|
) -> (AutomatonProducer, QueryEnhancer)
|
||||||
@ -99,7 +99,7 @@ pub fn normalize_str(string: &str) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn generate_automatons(
|
fn generate_automatons(
|
||||||
reader: &rkv::Reader,
|
reader: &impl rkv::Readable,
|
||||||
query: &str,
|
query: &str,
|
||||||
synonym_store: store::Synonyms,
|
synonym_store: store::Synonyms,
|
||||||
) -> Result<(Vec<Vec<Automaton>>, QueryEnhancer), rkv::StoreError>
|
) -> Result<(Vec<Vec<Automaton>>, QueryEnhancer), rkv::StoreError>
|
||||||
|
@ -21,8 +21,6 @@ use self::ranked_map::RankedMap;
|
|||||||
use zerocopy::{AsBytes, FromBytes};
|
use zerocopy::{AsBytes, FromBytes};
|
||||||
use ::serde::{Serialize, Deserialize};
|
use ::serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
pub type BEI64 = zerocopy::I64<byteorder::BigEndian>;
|
|
||||||
|
|
||||||
/// Represent an internally generated document unique identifier.
|
/// Represent an internally generated document unique identifier.
|
||||||
///
|
///
|
||||||
/// It is used to inform the database the document you want to deserialize.
|
/// It is used to inform the database the document you want to deserialize.
|
||||||
|
@ -119,7 +119,7 @@ fn multiword_rewrite_matches(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fetch_raw_documents(
|
fn fetch_raw_documents(
|
||||||
reader: &rkv::Reader,
|
reader: &impl rkv::Readable,
|
||||||
automatons: &[Automaton],
|
automatons: &[Automaton],
|
||||||
query_enhancer: &QueryEnhancer,
|
query_enhancer: &QueryEnhancer,
|
||||||
searchables: Option<&ReorderedAttrs>,
|
searchables: Option<&ReorderedAttrs>,
|
||||||
@ -203,7 +203,7 @@ impl<'a> QueryBuilder<'a> {
|
|||||||
|
|
||||||
pub fn query(
|
pub fn query(
|
||||||
self,
|
self,
|
||||||
reader: &rkv::Reader,
|
reader: &impl rkv::Readable,
|
||||||
query: &str,
|
query: &str,
|
||||||
range: Range<usize>,
|
range: Range<usize>,
|
||||||
) -> MResult<Vec<Document>>
|
) -> MResult<Vec<Document>>
|
||||||
|
@ -63,9 +63,9 @@ impl DocumentsFields {
|
|||||||
Ok(count)
|
Ok(count)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn document_field<'a, T: rkv::Readable>(
|
pub fn document_field<'a>(
|
||||||
&self,
|
&self,
|
||||||
reader: &'a T,
|
reader: &'a impl rkv::Readable,
|
||||||
document_id: DocumentId,
|
document_id: DocumentId,
|
||||||
attribute: SchemaAttr,
|
attribute: SchemaAttr,
|
||||||
) -> Result<Option<&'a [u8]>, rkv::StoreError>
|
) -> Result<Option<&'a [u8]>, rkv::StoreError>
|
||||||
|
@ -26,9 +26,9 @@ impl Main {
|
|||||||
self.main.put(writer, WORDS_KEY, &blob)
|
self.main.put(writer, WORDS_KEY, &blob)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn words_fst<T: rkv::Readable>(
|
pub fn words_fst(
|
||||||
&self,
|
&self,
|
||||||
reader: &T,
|
reader: &impl rkv::Readable,
|
||||||
) -> MResult<Option<fst::Set>>
|
) -> MResult<Option<fst::Set>>
|
||||||
{
|
{
|
||||||
match self.main.get(reader, WORDS_KEY)? {
|
match self.main.get(reader, WORDS_KEY)? {
|
||||||
@ -56,9 +56,9 @@ impl Main {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ranked_map<T: rkv::Readable>(
|
pub fn ranked_map(
|
||||||
&self,
|
&self,
|
||||||
reader: &T,
|
reader: &impl rkv::Readable,
|
||||||
) -> MResult<Option<RankedMap>>
|
) -> MResult<Option<RankedMap>>
|
||||||
{
|
{
|
||||||
match self.main.get(reader, RANKED_MAP_KEY)? {
|
match self.main.get(reader, RANKED_MAP_KEY)? {
|
||||||
@ -82,9 +82,9 @@ impl Main {
|
|||||||
Ok(new)
|
Ok(new)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn number_of_documents<T: rkv::Readable>(
|
pub fn number_of_documents(
|
||||||
&self,
|
&self,
|
||||||
reader: &T,
|
reader: &impl rkv::Readable,
|
||||||
) -> Result<u64, rkv::StoreError>
|
) -> Result<u64, rkv::StoreError>
|
||||||
{
|
{
|
||||||
match self.main.get(reader, NUMBER_OF_DOCUMENTS_KEY)? {
|
match self.main.get(reader, NUMBER_OF_DOCUMENTS_KEY)? {
|
||||||
|
@ -31,9 +31,9 @@ impl PostingsLists {
|
|||||||
self.postings_lists.delete(writer, word)
|
self.postings_lists.delete(writer, word)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn postings_list<'a, T: rkv::Readable>(
|
pub fn postings_list<'a>(
|
||||||
&self,
|
&self,
|
||||||
reader: &'a T,
|
reader: &'a impl rkv::Readable,
|
||||||
word: &[u8],
|
word: &[u8],
|
||||||
) -> Result<Option<Cow<'a, sdset::Set<DocIndex>>>, rkv::StoreError>
|
) -> Result<Option<Cow<'a, sdset::Set<DocIndex>>>, rkv::StoreError>
|
||||||
{
|
{
|
||||||
|
@ -4,17 +4,17 @@ pub struct Synonyms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Synonyms {
|
impl Synonyms {
|
||||||
pub fn synonyms_fst<T: rkv::Readable>(
|
pub fn synonyms_fst(
|
||||||
&self,
|
&self,
|
||||||
reader: &T,
|
reader: &impl rkv::Readable,
|
||||||
) -> Result<fst::Set, rkv::StoreError>
|
) -> Result<fst::Set, rkv::StoreError>
|
||||||
{
|
{
|
||||||
Ok(fst::Set::default())
|
Ok(fst::Set::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alternatives_to<T: rkv::Readable>(
|
pub fn alternatives_to(
|
||||||
&self,
|
&self,
|
||||||
reader: &T,
|
reader: &impl rkv::Readable,
|
||||||
word: &[u8],
|
word: &[u8],
|
||||||
) -> Result<Option<fst::Set>, rkv::StoreError>
|
) -> Result<Option<fst::Set>, rkv::StoreError>
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,9 @@ pub struct Updates {
|
|||||||
impl Updates {
|
impl Updates {
|
||||||
// TODO we should use the MDB_LAST op but
|
// TODO we should use the MDB_LAST op but
|
||||||
// it is not exposed by the rkv library
|
// it is not exposed by the rkv library
|
||||||
fn last_update_id<'a, T: rkv::Readable>(
|
fn last_update_id<'a>(
|
||||||
&self,
|
&self,
|
||||||
reader: &'a T,
|
reader: &'a impl rkv::Readable,
|
||||||
) -> Result<Option<(u64, Option<Value<'a>>)>, rkv::StoreError>
|
) -> Result<Option<(u64, Option<Value<'a>>)>, rkv::StoreError>
|
||||||
{
|
{
|
||||||
let mut last = None;
|
let mut last = None;
|
||||||
@ -33,9 +33,9 @@ impl Updates {
|
|||||||
Ok(Some((number, last_data)))
|
Ok(Some((number, last_data)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn contains<T: rkv::Readable>(
|
pub fn contains(
|
||||||
&self,
|
&self,
|
||||||
reader: &T,
|
reader: &impl rkv::Readable,
|
||||||
update_id: u64,
|
update_id: u64,
|
||||||
) -> Result<bool, rkv::StoreError>
|
) -> Result<bool, rkv::StoreError>
|
||||||
{
|
{
|
||||||
|
@ -21,9 +21,9 @@ impl UpdatesResults {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_result<T: rkv::Readable>(
|
pub fn update_result(
|
||||||
&self,
|
&self,
|
||||||
reader: &T,
|
reader: &impl rkv::Readable,
|
||||||
update_id: u64,
|
update_id: u64,
|
||||||
) -> MResult<Option<UpdateResult>>
|
) -> MResult<Option<UpdateResult>>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user