mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +08:00
Prefer using the impl syntax
This commit is contained in:
parent
38e474deaf
commit
3476939b7e
@ -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<Vec<Automaton>>, QueryEnhancer), rkv::StoreError>
|
||||
|
@ -21,8 +21,6 @@ use self::ranked_map::RankedMap;
|
||||
use zerocopy::{AsBytes, FromBytes};
|
||||
use ::serde::{Serialize, Deserialize};
|
||||
|
||||
pub type BEI64 = zerocopy::I64<byteorder::BigEndian>;
|
||||
|
||||
/// Represent an internally generated document unique identifier.
|
||||
///
|
||||
/// 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(
|
||||
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<usize>,
|
||||
) -> MResult<Vec<Document>>
|
||||
|
@ -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<Option<&'a [u8]>, rkv::StoreError>
|
||||
|
@ -26,9 +26,9 @@ impl Main {
|
||||
self.main.put(writer, WORDS_KEY, &blob)
|
||||
}
|
||||
|
||||
pub fn words_fst<T: rkv::Readable>(
|
||||
pub fn words_fst(
|
||||
&self,
|
||||
reader: &T,
|
||||
reader: &impl rkv::Readable,
|
||||
) -> MResult<Option<fst::Set>>
|
||||
{
|
||||
match self.main.get(reader, WORDS_KEY)? {
|
||||
@ -56,9 +56,9 @@ impl Main {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn ranked_map<T: rkv::Readable>(
|
||||
pub fn ranked_map(
|
||||
&self,
|
||||
reader: &T,
|
||||
reader: &impl rkv::Readable,
|
||||
) -> MResult<Option<RankedMap>>
|
||||
{
|
||||
match self.main.get(reader, RANKED_MAP_KEY)? {
|
||||
@ -82,9 +82,9 @@ impl Main {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
pub fn number_of_documents<T: rkv::Readable>(
|
||||
pub fn number_of_documents(
|
||||
&self,
|
||||
reader: &T,
|
||||
reader: &impl rkv::Readable,
|
||||
) -> Result<u64, rkv::StoreError>
|
||||
{
|
||||
match self.main.get(reader, NUMBER_OF_DOCUMENTS_KEY)? {
|
||||
|
@ -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<Option<Cow<'a, sdset::Set<DocIndex>>>, rkv::StoreError>
|
||||
{
|
||||
|
@ -4,17 +4,17 @@ pub struct Synonyms {
|
||||
}
|
||||
|
||||
impl Synonyms {
|
||||
pub fn synonyms_fst<T: rkv::Readable>(
|
||||
pub fn synonyms_fst(
|
||||
&self,
|
||||
reader: &T,
|
||||
reader: &impl rkv::Readable,
|
||||
) -> Result<fst::Set, rkv::StoreError>
|
||||
{
|
||||
Ok(fst::Set::default())
|
||||
}
|
||||
|
||||
pub fn alternatives_to<T: rkv::Readable>(
|
||||
pub fn alternatives_to(
|
||||
&self,
|
||||
reader: &T,
|
||||
reader: &impl rkv::Readable,
|
||||
word: &[u8],
|
||||
) -> Result<Option<fst::Set>, rkv::StoreError>
|
||||
{
|
||||
|
@ -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<Option<(u64, Option<Value<'a>>)>, rkv::StoreError>
|
||||
{
|
||||
let mut last = None;
|
||||
@ -33,9 +33,9 @@ impl Updates {
|
||||
Ok(Some((number, last_data)))
|
||||
}
|
||||
|
||||
pub fn contains<T: rkv::Readable>(
|
||||
pub fn contains(
|
||||
&self,
|
||||
reader: &T,
|
||||
reader: &impl rkv::Readable,
|
||||
update_id: u64,
|
||||
) -> Result<bool, rkv::StoreError>
|
||||
{
|
||||
|
@ -21,9 +21,9 @@ impl UpdatesResults {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn update_result<T: rkv::Readable>(
|
||||
pub fn update_result(
|
||||
&self,
|
||||
reader: &T,
|
||||
reader: &impl rkv::Readable,
|
||||
update_id: u64,
|
||||
) -> MResult<Option<UpdateResult>>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user