| Index: chrome/browser/history/scored_history_match.cc
|
| diff --git a/chrome/browser/history/scored_history_match.cc b/chrome/browser/history/scored_history_match.cc
|
| index 592b4652ce851120c596a44330c17d5113e7f097..9d6207a3e282c14b00e988e4234e716ec547bfe0 100644
|
| --- a/chrome/browser/history/scored_history_match.cc
|
| +++ b/chrome/browser/history/scored_history_match.cc
|
| @@ -248,6 +248,33 @@ bool ScoredHistoryMatch::MatchScoreGreater(const ScoredHistoryMatch& m1,
|
| return m1.url_info.last_visit() > m2.url_info.last_visit();
|
| }
|
|
|
| +// static
|
| +TermMatches ScoredHistoryMatch::FilterTermMatchesByWordStarts(
|
| + const TermMatches& term_matches,
|
| + const WordStarts& word_starts,
|
| + const size_t start_pos) {
|
| + if (start_pos == std::string::npos)
|
| + return term_matches;
|
| + TermMatches filtered_matches;
|
| + WordStarts::const_iterator next_word_starts = word_starts.begin();
|
| + WordStarts::const_iterator end_word_starts = word_starts.end();
|
| + for (TermMatches::const_iterator iter = term_matches.begin();
|
| + iter != term_matches.end(); ++iter) {
|
| + // Advance next_word_starts until it's >= the position of the term
|
| + // we're considering.
|
| + while ((next_word_starts != end_word_starts) &&
|
| + (*next_word_starts < iter->offset))
|
| + ++next_word_starts;
|
| + // Add the match if it's before the position we start filtering at or
|
| + // if it's at a word boundary.
|
| + if ((iter->offset < start_pos) ||
|
| + ((next_word_starts != end_word_starts) &&
|
| + (*next_word_starts == iter->offset)))
|
| + filtered_matches.push_back(*iter);
|
| + }
|
| + return filtered_matches;
|
| +}
|
| +
|
| float ScoredHistoryMatch::GetTopicalityScore(
|
| const int num_terms,
|
| const string16& url,
|
| @@ -377,33 +404,6 @@ float ScoredHistoryMatch::GetTopicalityScore(
|
| }
|
|
|
| // static
|
| -TermMatches ScoredHistoryMatch::FilterTermMatchesByWordStarts(
|
| - const TermMatches& term_matches,
|
| - const WordStarts& word_starts,
|
| - const size_t start_pos) {
|
| - if (start_pos == std::string::npos)
|
| - return term_matches;
|
| - TermMatches filtered_matches;
|
| - WordStarts::const_iterator next_word_starts = word_starts.begin();
|
| - WordStarts::const_iterator end_word_starts = word_starts.end();
|
| - for (TermMatches::const_iterator iter = term_matches.begin();
|
| - iter != term_matches.end(); ++iter) {
|
| - // Advance next_word_starts until it's >= the position of the term
|
| - // we're considering.
|
| - while ((next_word_starts != end_word_starts) &&
|
| - (*next_word_starts < iter->offset))
|
| - ++next_word_starts;
|
| - // Add the match if it's before the position we start filtering at or
|
| - // if it's at a word boundary.
|
| - if ((iter->offset < start_pos) ||
|
| - ((next_word_starts != end_word_starts) &&
|
| - (*next_word_starts == iter->offset)))
|
| - filtered_matches.push_back(*iter);
|
| - }
|
| - return filtered_matches;
|
| -}
|
| -
|
| -// static
|
| void ScoredHistoryMatch::FillInTermScoreToTopicalityScoreArray() {
|
| for (int term_score = 0; term_score < kMaxRawTermScore; ++term_score) {
|
| float topicality_score;
|
|
|