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: 11 27message IcingSearchEngineOptions { 28 // Directory to persist files for Icing. Required. 29 // If Icing was previously initialized with this directory, it will reload 30 // the index saved by the last instance. 31 optional string base_dir = 1; 32 33 // The maximum allowable token length. All tokens in excess of this size 34 // will be truncated to max_token_length before being indexed. 35 // 36 // Clients may use this option to prevent unnecessary indexing of long tokens. 37 // Depending on the use case, indexing all of 38 // 'Supercalifragilisticexpialidocious' may be unnecessary - a user is 39 // unlikely to type that entire query. So only indexing the first n bytes may 40 // still provide the desired behavior without wasting resources. 41 // 42 // Valid values: [1, INT_MAX] 43 // Optional. 44 optional int32 max_token_length = 3 [default = 30]; 45 46 // The size (measured in bytes) at which Icing's internal indices should be 47 // merged. Icing buffers changes together before merging them into a more 48 // compact format. When the buffer exceeds index_merge_size during a Put 49 // operation, the buffer is merged into the larger, more compact index. 50 // 51 // This more compact index is more efficient to search over as the index 52 // grows larger and has smaller system health impact. 53 // 54 // Setting a low index_merge_size increases the frequency of merges - 55 // increasing indexing-time latency and flash wear. Setting a high 56 // index_merge_size leads to larger resource usage and higher query latency. 57 // Valid values: [1, INT_MAX] 58 // Optional. 59 optional int32 index_merge_size = 4 [default = 1048576]; // 1 MiB 60 61 // Whether to use namespace id or namespace name to build up fingerprint for 62 // document_key_mapper_ and corpus_mapper_ in document store. 63 // TODO(b/259969017) Flip the default value of this flag to true at the time 64 // when we switch to use persistent hash map for document_key_mapper_ so that 65 // we just need one reconstruction of the internal mappers. 66 optional bool document_store_namespace_id_fingerprint = 5; 67 68 // The threshold of the percentage of invalid documents to rebuild index 69 // during optimize, i.e. we rebuild index if and only if 70 // |invalid_documents| / |all_documents| >= optimize_rebuild_index_threshold 71 // 72 // Rebuilding the index could be faster than optimizing the index if we have 73 // removed most of the documents. 74 // Based on benchmarks, 85%~95% seems to be a good threshold for most cases. 75 // 76 // Default to 0 for better rollout of the new index optimize. 77 optional float optimize_rebuild_index_threshold = 6 [default = 0.0]; 78 79 // Level of compression, NO_COMPRESSION = 0, BEST_SPEED = 1, 80 // BEST_COMPRESSION = 9 81 // Valid values: [0, 9] 82 // Optional. 83 optional int32 compression_level = 7 [default = 3]; 84 85 // OPTIONAL: Whether to allow circular references between schema types for 86 // the schema definition. 87 // 88 // Even when set to true, circular references are still not allowed in the 89 // following cases: 90 // 1. All edges of a cycle have index_nested_properties=true 91 // 2. One of the types in the cycle has a joinable property, or depends on 92 // a type with a joinable property. 93 // This is because such a cycle would lead to an infinite number of 94 // indexed/joinable properties: 95 // 96 // The default value is false. 97 optional bool allow_circular_schema_definitions = 8; 98 99 // Whether memory map max possible file size for FileBackedVector before 100 // growing the actual file size. 101 optional bool pre_mapping_fbv = 9; 102 103 // Whether use persistent hash map as the key mapper (if false, then fall back 104 // to dynamic trie key mapper). 105 optional bool use_persistent_hash_map = 10; 106 107 reserved 2; 108} 109 110// Result of a call to IcingSearchEngine.Initialize 111// Next tag: 3 112message InitializeResultProto { 113 // Status code can be one of: 114 // OK 115 // WARNING_DATA_LOSS 116 // INVALID_ARGUMENT 117 // NOT_FOUND 118 // INTERNAL 119 // 120 // See status.proto for more details. 121 // 122 // TODO(b/147699081): Fix error codes: +ABORTED, -NOT_FOUND. 123 // go/icing-library-apis. 124 optional StatusProto status = 1; 125 126 // Stats of the function call. Inside InitializeStatsProto, the function call 127 // latency 'latency_ms' will always be populated. The other fields will be 128 // accurate only when the status above is OK or WARNING_DATA_LOSS. See 129 // logging.proto for details. 130 optional InitializeStatsProto initialize_stats = 2; 131 132 // TODO(b/147699081): Add a field to indicate lost_schema and lost_documents. 133 // go/icing-library-apis. 134} 135