mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
Rename functions
This commit is contained in:
parent
9840b5c7fb
commit
7b02fdaddc
@ -146,7 +146,7 @@ impl Index {
|
|||||||
.attributes_to_crop
|
.attributes_to_crop
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let formatted_options = parse_formatted_options(
|
let formatted_options = compute_formatted_options(
|
||||||
&attr_to_highlight,
|
&attr_to_highlight,
|
||||||
&attr_to_crop,
|
&attr_to_crop,
|
||||||
query.crop_length,
|
query.crop_length,
|
||||||
@ -176,7 +176,7 @@ impl Index {
|
|||||||
|
|
||||||
for (_id, obkv) in self.documents(&rtxn, documents_ids)? {
|
for (_id, obkv) in self.documents(&rtxn, documents_ids)? {
|
||||||
let document = make_document(&to_retrieve_ids_sorted, &fields_ids_map, obkv)?;
|
let document = make_document(&to_retrieve_ids_sorted, &fields_ids_map, obkv)?;
|
||||||
let formatted = compute_formatted(
|
let formatted = format_fields(
|
||||||
&fields_ids_map,
|
&fields_ids_map,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
@ -218,7 +218,7 @@ impl Index {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_formatted_options(
|
fn compute_formatted_options(
|
||||||
attr_to_highlight: &HashSet<String>,
|
attr_to_highlight: &HashSet<String>,
|
||||||
attr_to_crop: &[String],
|
attr_to_crop: &[String],
|
||||||
query_crop_length: usize,
|
query_crop_length: usize,
|
||||||
@ -308,7 +308,7 @@ fn make_document(
|
|||||||
Ok(document)
|
Ok(document)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_formatted<A: AsRef<[u8]>>(
|
fn format_fields<A: AsRef<[u8]>>(
|
||||||
field_ids_map: &FieldsIdsMap,
|
field_ids_map: &FieldsIdsMap,
|
||||||
obkv: obkv::KvReader,
|
obkv: obkv::KvReader,
|
||||||
formatter: &Formatter<A>,
|
formatter: &Formatter<A>,
|
||||||
@ -347,7 +347,7 @@ fn compute_formatted<A: AsRef<[u8]>>(
|
|||||||
Ok(document)
|
Ok(document)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// trait to allow unit testing of `compute_formatted`
|
/// trait to allow unit testing of `format_fields`
|
||||||
trait Matcher {
|
trait Matcher {
|
||||||
fn matches(&self, w: &str) -> Option<usize>;
|
fn matches(&self, w: &str) -> Option<usize>;
|
||||||
}
|
}
|
||||||
@ -546,7 +546,7 @@ mod test {
|
|||||||
|
|
||||||
let matching_words = MatchingWords::default();
|
let matching_words = MatchingWords::default();
|
||||||
|
|
||||||
let value = compute_formatted(
|
let value = format_fields(
|
||||||
&fields,
|
&fields,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
@ -581,7 +581,7 @@ mod test {
|
|||||||
|
|
||||||
let matching_words = MatchingWords::default();
|
let matching_words = MatchingWords::default();
|
||||||
|
|
||||||
let value = compute_formatted(
|
let value = format_fields(
|
||||||
&fields,
|
&fields,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
@ -623,7 +623,7 @@ mod test {
|
|||||||
let mut matching_words = HashMap::new();
|
let mut matching_words = HashMap::new();
|
||||||
matching_words.insert("hobbit", Some(6));
|
matching_words.insert("hobbit", Some(6));
|
||||||
|
|
||||||
let value = compute_formatted(
|
let value = format_fields(
|
||||||
&fields,
|
&fields,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
@ -666,7 +666,7 @@ mod test {
|
|||||||
let mut matching_words = HashMap::new();
|
let mut matching_words = HashMap::new();
|
||||||
matching_words.insert("hobbit", Some(3));
|
matching_words.insert("hobbit", Some(3));
|
||||||
|
|
||||||
let value = compute_formatted(
|
let value = format_fields(
|
||||||
&fields,
|
&fields,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
@ -709,7 +709,7 @@ mod test {
|
|||||||
let mut matching_words = HashMap::new();
|
let mut matching_words = HashMap::new();
|
||||||
matching_words.insert("potter", Some(6));
|
matching_words.insert("potter", Some(6));
|
||||||
|
|
||||||
let value = compute_formatted(
|
let value = format_fields(
|
||||||
&fields,
|
&fields,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
@ -752,7 +752,7 @@ mod test {
|
|||||||
let mut matching_words = HashMap::new();
|
let mut matching_words = HashMap::new();
|
||||||
matching_words.insert("potter", Some(6));
|
matching_words.insert("potter", Some(6));
|
||||||
|
|
||||||
let value = compute_formatted(
|
let value = format_fields(
|
||||||
&fields,
|
&fields,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
@ -795,7 +795,7 @@ mod test {
|
|||||||
let mut matching_words = HashMap::new();
|
let mut matching_words = HashMap::new();
|
||||||
matching_words.insert("potter", Some(6));
|
matching_words.insert("potter", Some(6));
|
||||||
|
|
||||||
let value = compute_formatted(
|
let value = format_fields(
|
||||||
&fields,
|
&fields,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
@ -838,7 +838,7 @@ mod test {
|
|||||||
let mut matching_words = HashMap::new();
|
let mut matching_words = HashMap::new();
|
||||||
matching_words.insert("and", Some(3));
|
matching_words.insert("and", Some(3));
|
||||||
|
|
||||||
let value = compute_formatted(
|
let value = format_fields(
|
||||||
&fields,
|
&fields,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
@ -881,7 +881,7 @@ mod test {
|
|||||||
let mut matching_words = HashMap::new();
|
let mut matching_words = HashMap::new();
|
||||||
matching_words.insert("blood", Some(3));
|
matching_words.insert("blood", Some(3));
|
||||||
|
|
||||||
let value = compute_formatted(
|
let value = format_fields(
|
||||||
&fields,
|
&fields,
|
||||||
obkv,
|
obkv,
|
||||||
&formatter,
|
&formatter,
|
||||||
|
Loading…
Reference in New Issue
Block a user