• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 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
15syntax = "proto2";
16
17package icing.lib;
18
19import "icing/proto/logging.proto";
20import "icing/proto/status.proto";
21
22option java_package = "com.google.android.icing.proto";
23option java_multiple_files = true;
24option objc_class_prefix = "ICNG";
25
26// Next tag: 7
27message IcingSearchEngineFeatureInfoProto {
28  // REQUIRED: Enum representing an IcingLib feature flagged using
29  // IcingSearchEngineOptions
30  optional FlaggedFeatureType feature_type = 1;
31
32  enum FlaggedFeatureType {
33    // This value should never purposely be used. This is used for backwards
34    // compatibility reasons.
35    UNKNOWN = 0;
36
37    // Feature for flag
38    // IcingSearchEngineOptions::build_property_existence_metadata_hits.
39    //
40    // This feature covers the kHasPropertyFunctionFeature advanced query
41    // feature, and related metadata hits indexing used for property existence
42    // check.
43    FEATURE_HAS_PROPERTY_OPERATOR = 1;
44  }
45
46  // Whether the feature requires the document store to be rebuilt.
47  // The default value is false.
48  optional bool needs_document_store_rebuild = 2;
49
50  // Whether the feature requires the schema store to be rebuilt.
51  // The default value is false.
52  optional bool needs_schema_store_rebuild = 3;
53
54  // Whether the feature requires the term index to be rebuilt.
55  // The default value is false.
56  optional bool needs_term_index_rebuild = 4;
57
58  // Whether the feature requires the integer index to be rebuilt.
59  // The default value is false.
60  optional bool needs_integer_index_rebuild = 5;
61
62  // Whether the feature requires the qualified id join index to be rebuilt.
63  // The default value is false.
64  optional bool needs_qualified_id_join_index_rebuild = 6;
65}
66
67// Next tag: 4
68message IcingSearchEngineVersionProto {
69  // version and max_version are from the original version file.
70  optional int32 version = 1;
71  optional int32 max_version = 2;
72  // Features that are enabled in an icing version at initialization.
73  repeated IcingSearchEngineFeatureInfoProto enabled_features = 3;
74}
75
76// Next tag: 16
77message IcingSearchEngineOptions {
78  // Directory to persist files for Icing. Required.
79  // If Icing was previously initialized with this directory, it will reload
80  // the index saved by the last instance.
81  optional string base_dir = 1;
82
83  // The maximum allowable token length. All tokens in excess of this size
84  // will be truncated to max_token_length before being indexed.
85  //
86  // Clients may use this option to prevent unnecessary indexing of long tokens.
87  // Depending on the use case, indexing all of
88  // 'Supercalifragilisticexpialidocious' may be unnecessary - a user is
89  // unlikely to type that entire query. So only indexing the first n bytes may
90  // still provide the desired behavior without wasting resources.
91  //
92  // Valid values: [1, INT_MAX]
93  // Optional.
94  optional int32 max_token_length = 3 [default = 30];
95
96  // The size (measured in bytes) at which Icing's internal indices should be
97  // merged. Icing buffers changes together before merging them into a more
98  // compact format. When the buffer exceeds index_merge_size during a Put
99  // operation, the buffer is merged into the larger, more compact index.
100  //
101  // This more compact index is more efficient to search over as the index
102  // grows larger and has smaller system health impact.
103  //
104  // Setting a low index_merge_size increases the frequency of merges -
105  // increasing indexing-time latency and flash wear. Setting a high
106  // index_merge_size leads to larger resource usage and higher query latency.
107  // Valid values: [1, INT_MAX]
108  // Optional.
109  optional int32 index_merge_size = 4 [default = 1048576];  // 1 MiB
110
111  // Whether to use namespace id or namespace name to build up fingerprint for
112  // document_key_mapper_ and corpus_mapper_ in document store.
113  optional bool document_store_namespace_id_fingerprint = 5;
114
115  // The threshold of the percentage of invalid documents to rebuild index
116  // during optimize, i.e. we rebuild index if and only if
117  // |invalid_documents| / |all_documents| >= optimize_rebuild_index_threshold
118  //
119  // Rebuilding the index could be faster than optimizing the index if we have
120  // removed most of the documents.
121  // Based on benchmarks, 85%~95% seems to be a good threshold for most cases.
122  //
123  // Default to 0 for better rollout of the new index optimize.
124  optional float optimize_rebuild_index_threshold = 6 [default = 0.0];
125
126  // Level of compression, NO_COMPRESSION = 0, BEST_SPEED = 1,
127  // BEST_COMPRESSION = 9
128  // Valid values: [0, 9]
129  // Optional.
130  optional int32 compression_level = 7 [default = 3];
131
132  // OPTIONAL: Whether to allow circular references between schema types for
133  // the schema definition.
134  //
135  // Even when set to true, circular references are still not allowed in the
136  // following cases:
137  //    1. All edges of a cycle have index_nested_properties=true
138  //    2. One of the types in the cycle has a joinable property, or depends on
139  //       a type with a joinable property.
140  // This is because such a cycle would lead to an infinite number of
141  // indexed/joinable properties:
142  //
143  // The default value is false.
144  optional bool allow_circular_schema_definitions = 8;
145
146  // Whether memory map max possible file size for FileBackedVector before
147  // growing the actual file size.
148  optional bool pre_mapping_fbv = 9;
149
150  // Whether use persistent hash map as the key mapper (if false, then fall back
151  // to dynamic trie key mapper).
152  optional bool use_persistent_hash_map = 10;
153
154  // Integer index bucket split threshold.
155  optional int32 integer_index_bucket_split_threshold = 11 [default = 65536];
156
157  // Whether Icing should sort and merge its lite index HitBuffer unsorted tail
158  // at indexing time.
159  //
160  // If set to true, the HitBuffer will be sorted at indexing time after
161  // exceeding the sort threshold. If false, the HifBuffer will be sorted at
162  // querying time, before the first query after inserting new elements into the
163  // HitBuffer.
164  //
165  // The default value is false.
166  optional bool lite_index_sort_at_indexing = 12;
167
168  // Size (in bytes) at which Icing's lite index should sort and merge the
169  // HitBuffer's unsorted tail into the sorted head for sorting at indexing
170  // time. Size specified here is the maximum byte size to allow for the
171  // unsorted tail section.
172  //
173  // Setting a lower sort size reduces querying latency at the expense of
174  // indexing latency.
175  optional int32 lite_index_sort_size = 13 [default = 8192];  // 8 KiB
176
177  optional bool use_new_qualified_id_join_index = 14;
178
179  // Whether to build the metadata hits used for property existence check, which
180  // is required to support the hasProperty function in advanced query.
181  optional bool build_property_existence_metadata_hits = 15;
182
183  reserved 2;
184}
185
186// Result of a call to IcingSearchEngine.Initialize
187// Next tag: 3
188message InitializeResultProto {
189  // Status code can be one of:
190  //   OK
191  //   WARNING_DATA_LOSS
192  //   INVALID_ARGUMENT
193  //   NOT_FOUND
194  //   INTERNAL
195  //
196  // See status.proto for more details.
197  //
198  // TODO(b/147699081): Fix error codes: +ABORTED, -NOT_FOUND.
199  // go/icing-library-apis.
200  optional StatusProto status = 1;
201
202  // Stats of the function call. Inside InitializeStatsProto, the function call
203  // latency 'latency_ms' will always be populated. The other fields will be
204  // accurate only when the status above is OK or WARNING_DATA_LOSS. See
205  // logging.proto for details.
206  optional InitializeStatsProto initialize_stats = 2;
207
208  // TODO(b/147699081): Add a field to indicate lost_schema and lost_documents.
209  // go/icing-library-apis.
210}
211