Chromium Code Reviews| Index: ui/app_list/search/mixer.cc |
| diff --git a/ui/app_list/search/mixer.cc b/ui/app_list/search/mixer.cc |
| index 859b3839f47ba662faf31a7c269ecaf830289bd7..513efe18e8151aae1340ee6afa9af6d865c2a1eb 100644 |
| --- a/ui/app_list/search/mixer.cc |
| +++ b/ui/app_list/search/mixer.cc |
| @@ -62,10 +62,13 @@ class Mixer::Group { |
| for (const SearchProvider* provider : providers_) { |
| for (SearchResult* result : provider->results()) { |
| - DCHECK_GE(result->relevance(), 0.0); |
| - DCHECK_LE(result->relevance(), 1.0); |
| DCHECK(!result->id().empty()); |
| + // We cannot rely on providers to give relevance scores in the range |
| + // [0.0, 1.0] (e.g., PeopleProvider directly gives values from the |
| + // Google+ API). Clamp to that range. |
| + double relevance = std::min(std::max(result->relevance(), 0.0), 1.0); |
|
calamity
2015/02/09 03:52:28
Precautionary? Or was this actually DCHECKing?
Matt Giuca
2015/02/09 04:05:29
Precautionary.
(We can't have a DCHECK that relie
|
| + |
| double boost = boost_; |
| KnownResults::const_iterator known_it = |
| known_results.find(result->id()); |
| @@ -93,7 +96,7 @@ class Mixer::Group { |
| if (is_voice_query && result->voice_result()) |
| boost += 4.0; |
| - results_.push_back(SortData(result, result->relevance() + boost)); |
| + results_.push_back(SortData(result, relevance + boost)); |
| } |
| } |