• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2024 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_TRANSFORM_NORMALIZER_OPTIONS_H_
16 #define ICING_TRANSFORM_NORMALIZER_OPTIONS_H_
17 
18 namespace icing {
19 namespace lib {
20 
21 // TODO: b/332382299 - Avoid using default values in the NormalizerOptions
22 // constructor. This can lead to unexpected behavior.
23 struct NormalizerOptions {
24   explicit NormalizerOptions(int max_term_byte_size,
25                              bool enable_icu_normalizer = false)
max_term_byte_sizeNormalizerOptions26       : max_term_byte_size(max_term_byte_size),
27         enable_icu_normalizer(enable_icu_normalizer) {}
28 
29   // max_term_byte_size enforces the max size of text after normalization,
30   // text will be truncated if exceeds the max size.
31   int max_term_byte_size;
32 
33   // Determines whether to use an ICU based normalizer
34   // in icu-with-map-normalizer-factory or not.
35   // The default value is false, which means that the fallback option of a
36   // map based normalizer will be used.
37   //
38   // This flag is a no-op for all other normalizer factories because they
39   // only support one normalizer type.
40   bool enable_icu_normalizer;
41 };
42 
43 }  // namespace lib
44 }  // namespace icing
45 
46 #endif  // ICING_TRANSFORM_NORMALIZER_OPTIONS_H_
47