Chromium Code Reviews| Index: components/omnibox/browser/search_provider.cc |
| diff --git a/components/omnibox/browser/search_provider.cc b/components/omnibox/browser/search_provider.cc |
| index 926c3df2c29f4d7ee091a49dd42ddea6c6125ae6..e15b84a3e853d5a487045d99f767ea145c3bcc2a 100644 |
| --- a/components/omnibox/browser/search_provider.cc |
| +++ b/components/omnibox/browser/search_provider.cc |
| @@ -190,20 +190,17 @@ SearchProvider::~SearchProvider() { |
| // static |
| int SearchProvider::CalculateRelevanceForKeywordVerbatim( |
|
Peter Kasting
2015/11/12 20:36:10
Nit: Move this function to correspond with your mo
Mark P
2015/11/12 21:42:48
Done. Also moved several other functions that I n
|
| metrics::OmniboxInputType::Type type, |
| + bool allow_exact_keyword_match, |
| bool prefer_keyword) { |
| // This function is responsible for scoring verbatim query matches |
| - // for non-extension keywords. KeywordProvider::CalculateRelevance() |
| - // scores verbatim query matches for extension keywords, as well as |
| - // for keyword matches (i.e., suggestions of a keyword itself, not a |
| - // suggestion of a query on a keyword search engine). These two |
| - // functions are currently in sync, but there's no reason we |
| - // couldn't decide in the future to score verbatim matches |
| - // differently for extension and non-extension keywords. If you |
| - // make such a change, however, you should update this comment to |
| - // describe it, so it's clear why the functions diverge. |
| - if (prefer_keyword) |
| + // for non-extension substituting keywords. |
| + // KeywordProvider::CalculateRelevance() scores all other types of |
| + // keyword verbatim matches. |
| + if (allow_exact_keyword_match && prefer_keyword) |
| return 1500; |
| - return (type == metrics::OmniboxInputType::QUERY) ? 1450 : 1100; |
| + return (allow_exact_keyword_match && |
| + (type == metrics::OmniboxInputType::QUERY)) ? |
| + 1450 : 1100; |
| } |
| // static |
| @@ -1319,6 +1316,7 @@ int SearchProvider::GetKeywordVerbatimRelevance( |
| return use_server_relevance ? |
| keyword_results_.verbatim_relevance : |
| CalculateRelevanceForKeywordVerbatim(keyword_input_.type(), |
| + true, |
| keyword_input_.prefer_keyword()); |
| } |