Skip to content

Commit 349533f

Browse files
committed
fix: correctly init rank for and engine
1 parent e891a49 commit 349533f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/engine/andor.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ impl AndEngine {
7272

7373
fn merge_matched_items(&self, items: Vec<MatchResult>, text: &str) -> MatchResult {
7474
let mut ranges = MatchIndices::new();
75-
let mut rank = items[0].rank;
75+
let mut rank = crate::Rank {
76+
score: 0,
77+
begin: i32::MAX,
78+
end: i32::MIN,
79+
..items[0].rank
80+
};
7681
for item in items {
7782
match item.matched_range {
7883
MatchRange::ByteRange(..) => {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ pub struct Rank {
312312
}
313313

314314
/// Result of matching a query against an item
315-
#[derive(Clone)]
315+
#[derive(Clone, Debug)]
316316
pub struct MatchResult {
317317
/// The rank/score of this match
318318
pub rank: Rank,

0 commit comments

Comments
 (0)