Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4881)

Unified Diff: chrome/browser/history/in_memory_url_index.cc

Issue 7040009: Improve HQP Title Scoring (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/in_memory_url_index.cc
===================================================================
--- chrome/browser/history/in_memory_url_index.cc (revision 85919)
+++ chrome/browser/history/in_memory_url_index.cc (working copy)
@@ -748,8 +748,7 @@
match.url_matches.size() / terms.size();
int title_score =
ScoreComponentForMatches(match.title_matches, title.size()) *
- static_cast<int>(match.title_matches.size()) /
- static_cast<int>(terms.size());
+ match.title_matches.size() / terms.size();
// Arbitrarily pick the best.
// TODO(mrossetti): It might make sense that a term which appears in both the
// URL and the Title should boost the score a bit.
@@ -828,8 +827,12 @@
// that was matched.
size_t term_length_total = std::accumulate(matches.begin(), matches.end(),
0, AccumulateMatchLength);
+ const size_t kMaxSignificantLength = 50;
+ size_t max_significant_length =
+ std::min(max_length, std::max(term_length_total, kMaxSignificantLength));
const int kCompleteMaxValue = 500;
- int complete_value = term_length_total * kCompleteMaxValue / max_length;
+ int complete_value =
+ term_length_total * kCompleteMaxValue / max_significant_length;
int raw_score = order_value + start_value + complete_value;
const int kTermScoreLevel[] = { 1000, 650, 500, 200 };
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698