Fix logical error in relevance scoring implementation
This commit is contained in:
parent
c4f727bfb8
commit
f68fd669f3
1 changed files with 3 additions and 3 deletions
|
@ -252,14 +252,14 @@ impl CompletionRelevance {
|
|||
/// Provides a relevance score. Higher values are more relevant.
|
||||
///
|
||||
/// The absolute value of the relevance score is not meaningful, for
|
||||
/// example a value of 0 doesn't mean "not relevant", rather
|
||||
/// example a value of (!(0 as u32) / 2) doesn't mean "not relevant", rather
|
||||
/// it means "least relevant". The score value should only be used
|
||||
/// for relative ordering.
|
||||
///
|
||||
/// See is_relevant if you need to make some judgement about score
|
||||
/// in an absolute sense.
|
||||
pub fn score(self) -> u32 {
|
||||
let mut score = !0 / 2;
|
||||
let mut score = !(0 as u32) / 2;
|
||||
let CompletionRelevance {
|
||||
exact_name_match,
|
||||
type_match,
|
||||
|
@ -350,7 +350,7 @@ impl CompletionRelevance {
|
|||
/// some threshold such that we think it is especially likely
|
||||
/// to be relevant.
|
||||
pub fn is_relevant(&self) -> bool {
|
||||
self.score() > (!0 / 2)
|
||||
self.score() > !(0 as u32) / 2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue