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 num_to_score_in, 27 int max_num_total_hits) 28 : max_query_length(max_query_length_in), 29 num_to_score(num_to_score_in), 30 max_num_total_hits(max_num_total_hits) {} 31 32 // Search performance 33 34 // Maximum length of query to execute in IndexProcessor. 35 int max_query_length; 36 37 // Number of results to score in ScoringProcessor for every query. 38 int num_to_score; 39 40 // Memory 41 42 // Maximum number of ScoredDocumentHits to cache in the ResultStateManager at 43 // one time. 44 int max_num_total_hits; 45 }; 46 47 // TODO(b/149040810): Consider creating a class to manage performance 48 // configurations according to different devices/platforms/clients and even 49 // real-time memory usage. 50 51 } // namespace lib 52 } // namespace icing 53 54 #endif // ICING_PERFORMANCE_CONFIGURATION_H_ 55