mirror of
https://github.com/solaeus/nucleo.git
synced 2024-12-22 01:47:49 +00:00
fix scoring of new items
This commit is contained in:
parent
1756e47f44
commit
9c4b71027f
@ -89,10 +89,9 @@ impl<T: Sync + Send + 'static> Worker<T> {
|
|||||||
let Some(item) = self.items.get(idx) else {
|
let Some(item) = self.items.get(idx) else {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
let Some(score) = pattern.score(item.matcher_columns, matchers.get()) else {
|
if let Some(score) = pattern.score(item.matcher_columns, matchers.get()) {
|
||||||
return false;
|
self.matches.push(Match { score, idx });
|
||||||
};
|
};
|
||||||
self.matches.push(Match { score, idx });
|
|
||||||
false
|
false
|
||||||
});
|
});
|
||||||
let new_snapshot = self.items.par_snapshot(self.last_snapshot);
|
let new_snapshot = self.items.par_snapshot(self.last_snapshot);
|
||||||
@ -170,8 +169,6 @@ impl<T: Sync + Send + 'static> Worker<T> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut unmatched = AtomicU32::new(0);
|
|
||||||
self.process_new_items(&unmatched);
|
|
||||||
if pattern_status == pattern::Status::Rescore {
|
if pattern_status == pattern::Status::Rescore {
|
||||||
self.matches.clear();
|
self.matches.clear();
|
||||||
self.matches
|
self.matches
|
||||||
@ -179,9 +176,11 @@ impl<T: Sync + Send + 'static> Worker<T> {
|
|||||||
self.remove_in_flight_matches();
|
self.remove_in_flight_matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
let matchers = &self.matchers;
|
let mut unmatched = AtomicU32::new(0);
|
||||||
let pattern = &self.pattern;
|
|
||||||
if pattern_status != pattern::Status::Unchanged && !self.matches.is_empty() {
|
if pattern_status != pattern::Status::Unchanged && !self.matches.is_empty() {
|
||||||
|
self.process_new_items_trivial();
|
||||||
|
let matchers = &self.matchers;
|
||||||
|
let pattern = &self.pattern;
|
||||||
self.matches
|
self.matches
|
||||||
.par_iter_mut()
|
.par_iter_mut()
|
||||||
.take_any_while(|_| !self.canceled.load(atomic::Ordering::Relaxed))
|
.take_any_while(|_| !self.canceled.load(atomic::Ordering::Relaxed))
|
||||||
@ -201,6 +200,8 @@ impl<T: Sync + Send + 'static> Worker<T> {
|
|||||||
match_.idx = u32::MAX;
|
match_.idx = u32::MAX;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
self.process_new_items(&unmatched);
|
||||||
}
|
}
|
||||||
|
|
||||||
let canceled = par_quicksort(
|
let canceled = par_quicksort(
|
||||||
|
Loading…
Reference in New Issue
Block a user