xref: /aosp_15_r20/external/icing/icing/result/page-result.h (revision 8b6cd535a057e39b3b86660c4aa06c99747c2136)
1 // Copyright (C) 2022 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef ICING_RESULT_PAGE_RESULT_H_
16 #define ICING_RESULT_PAGE_RESULT_H_
17 
18 #include <vector>
19 
20 #include "icing/proto/search.pb.h"
21 
22 namespace icing {
23 namespace lib {
24 
25 // Contains information of the search result of one page.
26 struct PageResult {
PageResultPageResult27   PageResult(std::vector<SearchResultProto::ResultProto> results_in,
28              int num_results_with_snippets_in, int requested_page_size_in)
29       : results(std::move(results_in)),
30         num_results_with_snippets(num_results_with_snippets_in),
31         requested_page_size(requested_page_size_in) {}
32 
33   // Results of one page
34   std::vector<SearchResultProto::ResultProto> results;
35 
36   // Number of results with snippets.
37   int num_results_with_snippets;
38 
39   // The page size for this query. This should always be >= results.size().
40   int requested_page_size;
41 };
42 
43 }  // namespace lib
44 }  // namespace icing
45 
46 #endif  // ICING_RESULT_PAGE_RESULT_H_
47