mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 05:00:06 +01:00
feat: Introducing the Matches as_matches method
This commit is contained in:
parent
d21406a939
commit
ef7ba96d4a
@ -115,7 +115,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
print!("{}: ", name);
|
print!("{}: ", name);
|
||||||
let areas = create_highlight_areas(&text, &doc.matches, attr);
|
let areas = create_highlight_areas(&text, doc.matches.as_matches(), attr);
|
||||||
display_highlights(&text, &areas)?;
|
display_highlights(&text, &areas)?;
|
||||||
println!();
|
println!();
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut matching_attributes = HashSet::new();
|
let mut matching_attributes = HashSet::new();
|
||||||
for _match in doc.matches {
|
for _match in doc.matches.as_matches() {
|
||||||
let attr = SchemaAttr::new(_match.attribute.attribute());
|
let attr = SchemaAttr::new(_match.attribute.attribute());
|
||||||
let name = schema.attribute_name(attr);
|
let name = schema.attribute_name(attr);
|
||||||
matching_attributes.insert(name);
|
matching_attributes.insert(name);
|
||||||
|
@ -71,6 +71,10 @@ impl Matches {
|
|||||||
windows: self.slices.windows(2),
|
windows: self.slices.windows(2),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn as_matches(&self) -> &[Match] {
|
||||||
|
&self.matches
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct QueryIndexGroups<'a, 'b> {
|
pub struct QueryIndexGroups<'a, 'b> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user