| OLD | NEW |
| 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 #include "chrome/browser/history/url_index_private_data.h" | 5 #include "chrome/browser/history/url_index_private_data.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // in this step we are using the raw search string complete with escaped | 227 // in this step we are using the raw search string complete with escaped |
| 228 // URL elements. When the user has specifically typed something akin to | 228 // URL elements. When the user has specifically typed something akin to |
| 229 // "sort=pri&colspec=ID%20Mstone%20Release" we want to make sure that that | 229 // "sort=pri&colspec=ID%20Mstone%20Release" we want to make sure that that |
| 230 // specific substring appears in the URL or page title. | 230 // specific substring appears in the URL or page title. |
| 231 | 231 |
| 232 // We call these 'terms' (as opposed to 'words'; see above) as in this case | 232 // We call these 'terms' (as opposed to 'words'; see above) as in this case |
| 233 // we only want to break up the search string on 'true' whitespace rather than | 233 // we only want to break up the search string on 'true' whitespace rather than |
| 234 // escaped whitespace. When the user types "colspec=ID%20Mstone Release" we | 234 // escaped whitespace. When the user types "colspec=ID%20Mstone Release" we |
| 235 // get two 'terms': "colspec=id%20mstone" and "release". | 235 // get two 'terms': "colspec=id%20mstone" and "release". |
| 236 history::String16Vector lower_raw_terms; | 236 history::String16Vector lower_raw_terms; |
| 237 if (Tokenize(lower_raw_string, kWhitespaceUTF16, &lower_raw_terms) == 0) { | 237 if (Tokenize(lower_raw_string, base::kWhitespaceUTF16, |
| 238 &lower_raw_terms) == 0) { |
| 238 // Don't score matches when there are no terms to score against. (It's | 239 // Don't score matches when there are no terms to score against. (It's |
| 239 // possible that the word break iterater that extracts words to search | 240 // possible that the word break iterater that extracts words to search |
| 240 // for in the database allows some whitespace "words" whereas Tokenize | 241 // for in the database allows some whitespace "words" whereas Tokenize |
| 241 // excludes a long list of whitespace.) One could write a scoring | 242 // excludes a long list of whitespace.) One could write a scoring |
| 242 // function that gives a reasonable order to matches when there | 243 // function that gives a reasonable order to matches when there |
| 243 // are no terms (i.e., all the words are some form of whitespace), | 244 // are no terms (i.e., all the words are some form of whitespace), |
| 244 // but this is such a rare edge case that it's not worth the time. | 245 // but this is such a rare edge case that it's not worth the time. |
| 245 return scored_items; | 246 return scored_items; |
| 246 } | 247 } |
| 247 scored_items = std::for_each(history_id_set.begin(), history_id_set.end(), | 248 scored_items = std::for_each(history_id_set.begin(), history_id_set.end(), |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 // recently visited (within the last 12/24 hours) as highly important. Get | 1331 // recently visited (within the last 12/24 hours) as highly important. Get |
| 1331 // input from mpearson. | 1332 // input from mpearson. |
| 1332 if (r1.typed_count() != r2.typed_count()) | 1333 if (r1.typed_count() != r2.typed_count()) |
| 1333 return (r1.typed_count() > r2.typed_count()); | 1334 return (r1.typed_count() > r2.typed_count()); |
| 1334 if (r1.visit_count() != r2.visit_count()) | 1335 if (r1.visit_count() != r2.visit_count()) |
| 1335 return (r1.visit_count() > r2.visit_count()); | 1336 return (r1.visit_count() > r2.visit_count()); |
| 1336 return (r1.last_visit() > r2.last_visit()); | 1337 return (r1.last_visit() > r2.last_visit()); |
| 1337 } | 1338 } |
| 1338 | 1339 |
| 1339 } // namespace history | 1340 } // namespace history |
| OLD | NEW |