xref: /aosp_15_r20/external/icing/icing/performance-configuration.h (revision 8b6cd535a057e39b3b86660c4aa06c99747c2136)
1 // Copyright (C) 2019 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_PERFORMANCE_CONFIGURATION_H_
16 #define ICING_PERFORMANCE_CONFIGURATION_H_
17 
18 namespace icing {
19 namespace lib {
20 
21 // Stores key thresholds that affect performance of Icing search engine.
22 struct PerformanceConfiguration {
23   // Loads default configuration.
24   PerformanceConfiguration();
25 
PerformanceConfigurationPerformanceConfiguration26   PerformanceConfiguration(int max_query_length_in, int max_num_total_hits)
27       : max_query_length(max_query_length_in),
28         max_num_total_hits(max_num_total_hits) {}
29 
30   // Search performance
31 
32   // Maximum length of query to execute in IndexProcessor.
33   int max_query_length;
34 
35   // Memory
36 
37   // Maximum number of ScoredDocumentHits to cache in the ResultStateManager at
38   // one time.
39   int max_num_total_hits;
40 };
41 
42 // TODO(b/149040810): Consider creating a class to manage performance
43 // configurations according to different devices/platforms/clients and even
44 // real-time memory usage.
45 
46 }  // namespace lib
47 }  // namespace icing
48 
49 #endif  // ICING_PERFORMANCE_CONFIGURATION_H_
50