• 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/scoring.proto";
20
21option java_package = "com.google.android.icing.proto";
22option java_multiple_files = true;
23option objc_class_prefix = "ICNG";
24
25// Stats of the top-level function IcingSearchEngine::Initialize().
26// Next tag: 12
27message InitializeStatsProto {
28  // Overall time used for the function call.
29  optional int32 latency_ms = 1;
30
31  // The cause of IcingSearchEngine recovering from a previous bad state during
32  // initialization.
33  enum RecoveryCause {
34    // No recovery happened.
35    NONE = 0;
36
37    // Data loss in ground truth.
38    DATA_LOSS = 1;
39
40    // Data in index is inconsistent with ground truth.
41    INCONSISTENT_WITH_GROUND_TRUTH = 2;
42
43    // Changes were made to the schema, but possibly not fully applied to the
44    // document store and the index - requiring a recovery.
45    SCHEMA_CHANGES_OUT_OF_SYNC = 3;
46
47    // Random I/O errors.
48    IO_ERROR = 4;
49
50    // The document log is using legacy format.
51    LEGACY_DOCUMENT_LOG_FORMAT = 5;
52  }
53
54  // Possible recovery causes for document store:
55  // - DATA_LOSS
56  // - SCHEMA_CHANGES_OUT_OF_SYNC
57  // - IO_ERROR
58  optional RecoveryCause document_store_recovery_cause = 2;
59
60  // Possible recovery causes for index:
61  // - INCONSISTENT_WITH_GROUND_TRUTH
62  // - SCHEMA_CHANGES_OUT_OF_SYNC
63  // - IO_ERROR
64  optional RecoveryCause index_restoration_cause = 3;
65
66  // Possible recovery causes for index:
67  // - IO_ERROR
68  optional RecoveryCause schema_store_recovery_cause = 4;
69
70  // Time used to recover the document store.
71  optional int32 document_store_recovery_latency_ms = 5;
72
73  // Time used to restore the index.
74  optional int32 index_restoration_latency_ms = 6;
75
76  // Time used to restore the index.
77  optional int32 schema_store_recovery_latency_ms = 7;
78
79  // Status regarding how much data is lost during the initialization.
80  enum DocumentStoreDataStatus {
81    // Document store is successfully initialized or fully recovered.
82    NO_DATA_LOSS = 0;
83
84    // Ground truth data is partially lost.
85    PARTIAL_LOSS = 1;
86
87    // Ground truth data is completely lost.
88    COMPLETE_LOSS = 2;
89  }
90  optional DocumentStoreDataStatus document_store_data_status = 8;
91
92  // Number of documents currently in document store. Those may
93  // include alive, deleted, and expired documents.
94  optional int32 num_documents = 9;
95
96  // Number of schema types currently in schema store.
97  optional int32 num_schema_types = 10;
98
99  // Number of consecutive initialization failures that immediately preceded
100  // this initialization.
101  optional int32 num_previous_init_failures = 11;
102}
103
104// Stats of the top-level function IcingSearchEngine::Put().
105// Next tag: 7
106message PutDocumentStatsProto {
107  // Overall time used for the function call.
108  optional int32 latency_ms = 1;
109
110  // Time used to store the document.
111  optional int32 document_store_latency_ms = 2;
112
113  // Time used to index the document. It does not include the time to merge
114  // indices.
115  optional int32 index_latency_ms = 3;
116
117  // Time used to merge the indices.
118  optional int32 index_merge_latency_ms = 4;
119
120  // Document size in bytes.
121  optional int32 document_size = 5;
122
123  message TokenizationStats {
124    // Number of tokens added to the index.
125    optional int32 num_tokens_indexed = 1;
126
127    reserved 2;
128  }
129  optional TokenizationStats tokenization_stats = 6;
130}
131
132// Stats of the top-level function IcingSearchEngine::Search() and
133// IcingSearchEngine::GetNextPage().
134// Next tag: 17
135message QueryStatsProto {
136  // The UTF-8 length of the query string
137  optional int32 query_length = 16;
138
139  // Number of terms in the query string.
140  optional int32 num_terms = 1;
141
142  // Number of namespaces filtered.
143  optional int32 num_namespaces_filtered = 2;
144
145  // Number of schema types filtered.
146  optional int32 num_schema_types_filtered = 3;
147
148  // Strategy of scoring and ranking.
149  optional ScoringSpecProto.RankingStrategy.Code ranking_strategy = 4;
150
151  // Whether the function call is querying the first page. If it’s
152  // not, Icing will fetch the results from cache so that some steps
153  // may be skipped.
154  optional bool is_first_page = 5;
155
156  // The requested number of results in one page.
157  optional int32 requested_page_size = 6;
158
159  // The actual number of results returned in the current page.
160  optional int32 num_results_returned_current_page = 7;
161
162  // Number of documents scored.
163  optional int32 num_documents_scored = 8;
164
165  // How many of the results in the page returned were snippeted.
166  optional int32 num_results_with_snippets = 15;
167
168  // Overall time used for the function call.
169  optional int32 latency_ms = 10;
170
171  // Time used to parse the query, including 2 parts: tokenizing and
172  // transforming tokens into an iterator tree.
173  optional int32 parse_query_latency_ms = 11;
174
175  // Time used to score the raw results.
176  optional int32 scoring_latency_ms = 12;
177
178  // Time used to rank the scored results.
179  optional int32 ranking_latency_ms = 13;
180
181  // Time used to fetch the document protos. Note that it includes the
182  // time to snippet if ‘has_snippets’ is true.
183  optional int32 document_retrieval_latency_ms = 14;
184
185  reserved 9;
186}
187
188// Stats of the top-level functions IcingSearchEngine::Delete,
189// IcingSearchEngine::DeleteByNamespace, IcingSearchEngine::DeleteBySchemaType.
190// Next tag: 4
191message DeleteStatsProto {
192  // Overall time used for the function call.
193  optional int32 latency_ms = 1;
194
195  message DeleteType {
196    enum Code {
197      // Default. Should never be used.
198      UNKNOWN = 0;
199
200      // Delete one document.
201      SINGLE = 1;
202
203      // Delete by query. This value is deprecated.
204      // IcingSearchEngine::DeleteByQuery will return a DeleteByQueryStatsProto
205      // rather than a DeleteStatsProto.
206      DEPRECATED_QUERY = 2 [deprecated = true];
207
208      // Delete by namespace.
209      NAMESPACE = 3;
210
211      // Delete by schema type.
212      SCHEMA_TYPE = 4;
213    }
214  }
215  optional DeleteType.Code delete_type = 2;
216
217  // Number of documents deleted by this call.
218  optional int32 num_documents_deleted = 3;
219}
220
221// Stats of the top-level functions IcingSearchEngine::DeleteByQuery.
222// Next tag: 9
223message DeleteByQueryStatsProto {
224  // Overall time used for the function call.
225  optional int32 latency_ms = 1;
226
227  // Number of documents deleted by this call.
228  optional int32 num_documents_deleted = 2;
229
230  // The UTF-8 length of the query string
231  optional int32 query_length = 3;
232
233  // Number of terms in the query string.
234  optional int32 num_terms = 4;
235
236  // Number of namespaces filtered.
237  optional int32 num_namespaces_filtered = 5;
238
239  // Number of schema types filtered.
240  optional int32 num_schema_types_filtered = 6;
241
242  // Time used to parse the query, including 2 parts: tokenizing and
243  // transforming tokens into an iterator tree.
244  optional int32 parse_query_latency_ms = 7;
245
246  // Time used to delete each document.
247  optional int32 document_removal_latency_ms = 8;
248}
249