Index: chrome/browser/history/scored_history_match.h |
diff --git a/chrome/browser/history/scored_history_match.h b/chrome/browser/history/scored_history_match.h |
index c10f4f3b70d881f3c5dc81cd1d5b95c685ca436b..fc2a5e8cdfb2edf4af61ad6f6cc8614cb6d4265c 100644 |
--- a/chrome/browser/history/scored_history_match.h |
+++ b/chrome/browser/history/scored_history_match.h |
@@ -38,12 +38,26 @@ struct ScoredHistoryMatch : public history::HistoryMatch { |
BookmarkService* bookmark_service); |
~ScoredHistoryMatch(); |
- // Calculates a component score based on position, ordering and total |
- // substring match size using metrics recorded in |matches|. |max_length| |
- // is the length of the string against which the terms are being searched. |
- static int ScoreComponentForMatches(const TermMatches& matches, |
+ // Calculates a component score based on position, ordering, word |
+ // boundaries, and total substring match size using metrics recorded |
+ // in |matches| and |word_starts|. |max_length| is the length of |
+ // the string against which the terms are being searched. |
+ // |provided_matches| should already be sorted and de-dupped, and |
Peter Kasting
2012/12/01 01:21:44
Nit: dupped -> duped (multiple places)
Mark P
2012/12/01 01:55:32
Fixed three locations.
|
+ // |word_starts| must be sorted. |
+ static int ScoreComponentForMatches(const TermMatches& provided_matches, |
Peter Kasting
2012/12/01 01:21:44
Nit: |provided_matches| here versus |matches| in t
Mark P
2012/12/01 01:55:32
Done.
Also rename variable in the implementation.
|
+ const WordStarts& word_starts, |
size_t max_length); |
+ // Given a set of term matches |matches| and word boundaries |word_starts|, |
+ // fills in |matches_at_word_boundaries| with only the matches in |matches| |
+ // that are at word boundaries. |
+ // |matches| should already be sorted and de-dupped, and ||word_starts| |
Peter Kasting
2012/12/01 01:21:44
Nit: || -> |
Mark P
2012/12/01 01:55:32
Done.
|
+ // must be sorted. |
+ static void MakeTermMatchesOnlyAtWordBoundaries( |
+ const TermMatches& matches, |
+ const WordStarts& word_starts, |
+ TermMatches* matches_at_word_boundaries); |
+ |
// Converts a raw value for some particular scoring factor into a score |
// component for that factor. The conversion function is piecewise linear, |
// with input values provided in |value_ranks| and resulting output scores |
@@ -74,7 +88,9 @@ struct ScoredHistoryMatch : public history::HistoryMatch { |
// boundaries). |url_matches| and |title_matches| provide details |
// about where the matches in the URL and title are and what terms |
// (identified by a term number < |num_terms|) match where. |
- // |word_starts| explains where word boundaries are. |
+ // |word_starts| explains where word boundaries are. Its parts (title |
+ // and url) must be sorted. Also, |url_matches| and |
+ // |titles_matches| should already be sorted and de-dupped. |
static float GetTopicalityScore(const int num_terms, |
const string16& url, |
const TermMatches& url_matches, |
@@ -102,6 +118,9 @@ struct ScoredHistoryMatch : public history::HistoryMatch { |
// field trial state. |
static void InitializeNewScoringField(); |
+ // Sets only_count_matches_at_word_boundaries based on the field trial state. |
+ static void InitializeOnlyCountMatchesAtWordBoundariesField(); |
+ |
// Sets also_do_hup_like_scoring based on the field trial state. |
static void InitializeAlsoDoHUPLikeScoringField(); |
@@ -134,7 +153,7 @@ struct ScoredHistoryMatch : public history::HistoryMatch { |
static const int kMaxRawTermScore = 30; |
static float* raw_term_score_to_topicality_score; |
- // Allows us to determing setting for use_new_scoring_ only once. |
+ // Used so we initialize static variables only once (on first use). |
static bool initialized_; |
// Whether to use new-scoring or old-scoring. Set in the |
@@ -145,6 +164,9 @@ struct ScoredHistoryMatch : public history::HistoryMatch { |
// class as well (see boolean below). |
static bool use_new_scoring; |
+ // If true, we ignore all matches that are in the middle of a word. |
+ static bool only_count_matches_at_word_boundaries; |
+ |
// If true, assign raw scores to be max(whatever it normally would be, |
// a score that's similar to the score HistoryURL provider would assign). |
// This variable is set in the constructor by examining the field trial |