Home | History | Annotate | Download | only in query_parser

Lines Matching refs:snippet

5 #include "components/query_parser/snippet.h"
21 bool PairFirstLessThan(const Snippet::MatchPosition& a,
22 const Snippet::MatchPosition& b) {
29 Snippet::MatchPositions* match_positions) {
31 Snippet::MatchPosition& pair((*match_positions)[offset]);
45 Snippet::MatchPositions* match_positions) {
48 Snippet::MatchPosition pair(start, end);
55 Snippet::MatchPositions::iterator i =
129 // snippet generation. If not, revisit the way we scan in ComputeSnippet.
139 // Returns true if next match falls within a snippet window
164 void Snippet::ExtractMatchPositions(const std::string& offsets_str,
187 void Snippet::ConvertMatchPositionsToWide(
189 Snippet::MatchPositions* match_positions) {
195 for (Snippet::MatchPositions::iterator i = match_positions->begin();
206 Snippet::Snippet() {
209 Snippet::~Snippet() {
212 void Snippet::ComputeSnippet(const MatchPositions& match_positions,
230 // We build the snippet by iterating through the matches and then grabbing
233 base::string16 snippet;
250 snippet += kEllipsis;
253 snippet += base::UTF8ToUTF16(document.substr(start, match_start - start));
257 const size_t first = snippet.size();
258 snippet += base::UTF8ToUTF16(document.substr(match_start,
260 matches_.push_back(std::make_pair(first, snippet.size()));
264 // Check if the next match falls within our snippet window.
274 snippet += base::UTF8ToUTF16(document.substr(match_end, end - match_end));
282 snippet += base::UTF8ToUTF16(document.substr(match_end, end - match_end));
284 snippet += kEllipsis;
288 // Stop here if we have enough snippet computed.
289 if (snippet.size() >= kSnippetMaxLength)
294 swap(text_, snippet);
297 void Snippet::Swap(Snippet* other) {