1*8b6cd535SAndroid Build Coastguard Worker // Copyright (C) 2019 Google LLC 2*8b6cd535SAndroid Build Coastguard Worker // 3*8b6cd535SAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License"); 4*8b6cd535SAndroid Build Coastguard Worker // you may not use this file except in compliance with the License. 5*8b6cd535SAndroid Build Coastguard Worker // You may obtain a copy of the License at 6*8b6cd535SAndroid Build Coastguard Worker // 7*8b6cd535SAndroid Build Coastguard Worker // http://www.apache.org/licenses/LICENSE-2.0 8*8b6cd535SAndroid Build Coastguard Worker // 9*8b6cd535SAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software 10*8b6cd535SAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS, 11*8b6cd535SAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*8b6cd535SAndroid Build Coastguard Worker // See the License for the specific language governing permissions and 13*8b6cd535SAndroid Build Coastguard Worker // limitations under the License. 14*8b6cd535SAndroid Build Coastguard Worker 15*8b6cd535SAndroid Build Coastguard Worker #ifndef ICING_RESULT_SNIPPET_CONTEXT_H_ 16*8b6cd535SAndroid Build Coastguard Worker #define ICING_RESULT_SNIPPET_CONTEXT_H_ 17*8b6cd535SAndroid Build Coastguard Worker 18*8b6cd535SAndroid Build Coastguard Worker #include "icing/proto/search.pb.h" 19*8b6cd535SAndroid Build Coastguard Worker #include "icing/proto/term.pb.h" 20*8b6cd535SAndroid Build Coastguard Worker #include "icing/query/query-terms.h" 21*8b6cd535SAndroid Build Coastguard Worker 22*8b6cd535SAndroid Build Coastguard Worker namespace icing { 23*8b6cd535SAndroid Build Coastguard Worker namespace lib { 24*8b6cd535SAndroid Build Coastguard Worker 25*8b6cd535SAndroid Build Coastguard Worker // Stores data needed for snippeting. With SnippetContext we can fetch snippets 26*8b6cd535SAndroid Build Coastguard Worker // for queries with multiple pages. 27*8b6cd535SAndroid Build Coastguard Worker struct SnippetContext { SnippetContextSnippetContext28*8b6cd535SAndroid Build Coastguard Worker explicit SnippetContext(SectionRestrictQueryTermsMap query_terms_in, 29*8b6cd535SAndroid Build Coastguard Worker ResultSpecProto::SnippetSpecProto snippet_spec_in, 30*8b6cd535SAndroid Build Coastguard Worker TermMatchType::Code match_type_in) 31*8b6cd535SAndroid Build Coastguard Worker : query_terms(std::move(query_terms_in)), 32*8b6cd535SAndroid Build Coastguard Worker snippet_spec(std::move(snippet_spec_in)), 33*8b6cd535SAndroid Build Coastguard Worker match_type(match_type_in) {} 34*8b6cd535SAndroid Build Coastguard Worker 35*8b6cd535SAndroid Build Coastguard Worker // Query terms that are used to find snippets 36*8b6cd535SAndroid Build Coastguard Worker SectionRestrictQueryTermsMap query_terms; 37*8b6cd535SAndroid Build Coastguard Worker 38*8b6cd535SAndroid Build Coastguard Worker // Spec that defines some quantities of snippeting 39*8b6cd535SAndroid Build Coastguard Worker ResultSpecProto::SnippetSpecProto snippet_spec; 40*8b6cd535SAndroid Build Coastguard Worker 41*8b6cd535SAndroid Build Coastguard Worker // Defines how we match each term 42*8b6cd535SAndroid Build Coastguard Worker TermMatchType::Code match_type; 43*8b6cd535SAndroid Build Coastguard Worker }; 44*8b6cd535SAndroid Build Coastguard Worker 45*8b6cd535SAndroid Build Coastguard Worker } // namespace lib 46*8b6cd535SAndroid Build Coastguard Worker } // namespace icing 47*8b6cd535SAndroid Build Coastguard Worker 48*8b6cd535SAndroid Build Coastguard Worker #endif // ICING_RESULT_SNIPPET_CONTEXT_H_ 49