| 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..09c2135e756aeda2f76433612a32e33793ec542d 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-duped, and
|
| + // |word_starts| must be sorted.
|
| + static int ScoreComponentForMatches(const TermMatches& provided_matches,
|
| + const WordStarts& word_starts,
|
| size_t max_length);
|
|
|
| + // Given a set of term matches |provided_matches| and word boundaries
|
| + // |word_starts|, fills in |matches_at_word_boundaries| with only the
|
| + // matches in |provided_matches| that are at word boundaries.
|
| + // |provided_matches| should already be sorted and de-duped, and
|
| + // |word_starts| must be sorted.
|
| + static void MakeTermMatchesOnlyAtWordBoundaries(
|
| + const TermMatches& provided_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-duped.
|
| 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
|
|
|