xref: /aosp_15_r20/external/icing/icing/result/result-adjustment-info.h (revision 8b6cd535a057e39b3b86660c4aa06c99747c2136)
1 // Copyright (C) 2023 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_RESULT_ADJUSTMENT_INFO_H_
16 #define ICING_RESULT_RESULT_ADJUSTMENT_INFO_H_
17 
18 #include <string>
19 #include <unordered_map>
20 
21 #include "icing/proto/scoring.pb.h"
22 #include "icing/proto/search.pb.h"
23 #include "icing/result/projection-tree.h"
24 #include "icing/result/snippet-context.h"
25 #include "icing/schema/schema-store.h"
26 
27 namespace icing {
28 namespace lib {
29 
30 // A wrapper struct for information used in result retrieval.
31 // - Snippet
32 // - Projection
33 struct ResultAdjustmentInfo {
34   // Information needed for snippeting.
35   SnippetContext snippet_context;
36 
37   // Remaining # of docs to snippet.
38   int remaining_num_to_snippet;
39 
40   // Information needed for projection.
41   std::unordered_map<std::string, ProjectionTree> projection_tree_map;
42 
43   explicit ResultAdjustmentInfo(const SearchSpecProto& search_spec,
44                                 const ScoringSpecProto& scoring_spec,
45                                 const ResultSpecProto& result_spec,
46                                 const SchemaStore* schema_store,
47                                 SectionRestrictQueryTermsMap query_terms);
48 };
49 
50 }  // namespace lib
51 }  // namespace icing
52 
53 #endif  // ICING_RESULT_RESULT_ADJUSTMENT_INFO_H_
54