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

Side by Side Diff: chrome/browser/history/scored_history_match.h

Issue 10837244: Replace HistoryQuickProvider protobuf-based caching with an SQLite-based database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Tweak suppression. Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ 5 #ifndef CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_
6 #define CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ 6 #define CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/history/history_types.h" 13 #include "chrome/browser/history/history_types.h"
14 #include "chrome/browser/autocomplete/history_provider_util.h" 14 #include "chrome/browser/autocomplete/history_provider_util.h"
15 #include "chrome/browser/history/in_memory_url_index_types.h" 15 #include "chrome/browser/history/in_memory_url_index_types.h"
16 16
17 namespace history { 17 namespace history {
18 18
19 // An HistoryMatch that has a score as well as metrics defining where in the 19 // An HistoryMatch that has a score as well as metrics defining where in the
20 // history item's URL and/or page title matches have occurred. 20 // history item's URL and/or page title matches have occurred.
21 struct ScoredHistoryMatch : public history::HistoryMatch { 21 struct ScoredHistoryMatch : public history::HistoryMatch {
22 ScoredHistoryMatch(); // Required by STL. 22 ScoredHistoryMatch(); // Required by STL.
23 23
24 // Creates a new match with a raw score calculated for the history item given 24 // Creates a new match with a raw score calculated for the history item given
25 // in |row| by first determining if all of the terms in |terms_vector| occur 25 // in |row|. First determines if the row qualifies by seeing if all of the
26 // in |row| and, if so, calculating a raw score based on 1) starting position 26 // terms in |terms_vector| occur in |row|. If so, calculates a raw score.
27 // of each term in the user input, 2) completeness of each term's match, 27 // This raw score allows the results to be ordered and can be used to
28 // 3) ordering of the occurrence of each term (i.e. they appear in order), 28 // influence the final score calculated by the client of this index.
29 // 4) last visit time (compared to |now|), and 5) number of visits. 29 // If the row does not qualify the raw score will be 0.
30 // This raw score allows the results to be ordered and can be used
31 // to influence the final score calculated by the client of this
32 // index.
33 ScoredHistoryMatch(const URLRow& row, 30 ScoredHistoryMatch(const URLRow& row,
34 const string16& lower_string, 31 const string16& lower_string,
35 const String16Vector& terms_vector, 32 const String16Vector& terms_vector,
36 const RowWordStarts& word_starts, 33 const RowWordStarts& word_starts,
37 const base::Time now); 34 const base::Time now);
38 ~ScoredHistoryMatch(); 35 ~ScoredHistoryMatch();
39 36
40 // Calculates a component score based on position, ordering and total 37 // Calculates a component score based on position, ordering and total
41 // substring match size using metrics recorded in |matches|. |max_length| 38 // substring match size using metrics recorded in |matches|. |max_length|
42 // is the length of the string against which the terms are being searched. 39 // is the length of the string against which the terms are being searched.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 131
135 // Whether to use new-score or old-scoring. Set in the constructor 132 // Whether to use new-score or old-scoring. Set in the constructor
136 // by examining command line flags. 133 // by examining command line flags.
137 static bool use_new_scoring; 134 static bool use_new_scoring;
138 }; 135 };
139 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches; 136 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches;
140 137
141 } // namespace history 138 } // namespace history
142 139
143 #endif // CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ 140 #endif // CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698