aboutsummaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorAlexander Dorokhine <adorokhine@google.com>2021-08-13 11:07:18 -0700
committerAlexander Dorokhine <adorokhine@google.com>2021-08-13 11:07:18 -0700
commit71eeeb436ec794daef5187d12ca9aba2c5773d7d (patch)
tree5129f3a74eb616eb2856c6db3392011c1ce384f8 /proto
parent40c7203fab1d491f62f223fad10eddc180605729 (diff)
downloadicing-71eeeb436ec794daef5187d12ca9aba2c5773d7d.tar.gz
Merge androidx-platform-dev/external/icing upstream-master into upstream-master
Change-Id: Id39bea14b3a3d378d722dc552e4f3bd4249f3f94
Diffstat (limited to 'proto')
-rw-r--r--proto/icing/proto/document.proto6
-rw-r--r--proto/icing/proto/document_wrapper.proto4
-rw-r--r--proto/icing/proto/logging.proto56
-rw-r--r--proto/icing/proto/persist.proto22
-rw-r--r--proto/icing/proto/schema.proto17
-rw-r--r--proto/icing/proto/search.proto66
-rw-r--r--proto/icing/proto/storage.proto56
-rw-r--r--proto/icing/proto/usage.proto10
8 files changed, 203 insertions, 34 deletions
diff --git a/proto/icing/proto/document.proto b/proto/icing/proto/document.proto
index 9a4e5b9..2e8321b 100644
--- a/proto/icing/proto/document.proto
+++ b/proto/icing/proto/document.proto
@@ -209,7 +209,7 @@ message DeleteBySchemaTypeResultProto {
}
// Result of a call to IcingSearchEngine.DeleteByQuery
-// Next tag: 3
+// Next tag: 4
message DeleteByQueryResultProto {
// Status code can be one of:
// OK
@@ -224,5 +224,7 @@ message DeleteByQueryResultProto {
optional StatusProto status = 1;
// Stats for delete execution performance.
- optional DeleteStatsProto delete_stats = 2;
+ optional DeleteByQueryStatsProto delete_by_query_stats = 3;
+
+ reserved 2;
}
diff --git a/proto/icing/proto/document_wrapper.proto b/proto/icing/proto/document_wrapper.proto
index e8eb992..929ee33 100644
--- a/proto/icing/proto/document_wrapper.proto
+++ b/proto/icing/proto/document_wrapper.proto
@@ -20,7 +20,6 @@ import "icing/proto/document.proto";
option java_package = "com.google.android.icing.proto";
option java_multiple_files = true;
-
option objc_class_prefix = "ICNG";
// DocumentWrapper as a wrapper of the user-facing DocumentProto is meant to
@@ -30,6 +29,5 @@ option objc_class_prefix = "ICNG";
message DocumentWrapper {
optional DocumentProto document = 1;
- // Indicates if the document is marked as deleted
- optional bool deleted = 2;
+ reserved 2;
}
diff --git a/proto/icing/proto/logging.proto b/proto/icing/proto/logging.proto
index e9509d4..4dcfecf 100644
--- a/proto/icing/proto/logging.proto
+++ b/proto/icing/proto/logging.proto
@@ -40,8 +40,9 @@ message InitializeStatsProto {
// Data in index is inconsistent with ground truth.
INCONSISTENT_WITH_GROUND_TRUTH = 2;
- // Total checksum of all the components does not match.
- TOTAL_CHECKSUM_MISMATCH = 3;
+ // Changes were made to the schema, but possibly not fully applied to the
+ // document store and the index - requiring a recovery.
+ SCHEMA_CHANGES_OUT_OF_SYNC = 3;
// Random I/O errors.
IO_ERROR = 4;
@@ -49,13 +50,13 @@ message InitializeStatsProto {
// Possible recovery causes for document store:
// - DATA_LOSS
- // - TOTAL_CHECKSUM_MISMATCH
+ // - SCHEMA_CHANGES_OUT_OF_SYNC
// - IO_ERROR
optional RecoveryCause document_store_recovery_cause = 2;
// Possible recovery causes for index:
// - INCONSISTENT_WITH_GROUND_TRUTH
- // - TOTAL_CHECKSUM_MISMATCH
+ // - SCHEMA_CHANGES_OUT_OF_SYNC
// - IO_ERROR
optional RecoveryCause index_restoration_cause = 3;
@@ -125,8 +126,11 @@ message PutDocumentStatsProto {
// Stats of the top-level function IcingSearchEngine::Search() and
// IcingSearchEngine::GetNextPage().
-// Next tag: 15
+// Next tag: 17
message QueryStatsProto {
+ // The UTF-8 length of the query string
+ optional int32 query_length = 16;
+
// Number of terms in the query string.
optional int32 num_terms = 1;
@@ -154,7 +158,7 @@ message QueryStatsProto {
optional int32 num_documents_scored = 8;
// How many of the results in the page returned were snippeted.
- optional bool num_results_snippeted = 9;
+ optional int32 num_results_with_snippets = 15;
// Overall time used for the function call.
optional int32 latency_ms = 10;
@@ -172,11 +176,12 @@ message QueryStatsProto {
// Time used to fetch the document protos. Note that it includes the
// time to snippet if ‘has_snippets’ is true.
optional int32 document_retrieval_latency_ms = 14;
+
+ reserved 9;
}
// Stats of the top-level functions IcingSearchEngine::Delete,
-// IcingSearchEngine::DeleteByNamespace, IcingSearchEngine::DeleteBySchemaType,
-// IcingSearchEngine::DeleteByQuery.
+// IcingSearchEngine::DeleteByNamespace, IcingSearchEngine::DeleteBySchemaType.
// Next tag: 4
message DeleteStatsProto {
// Overall time used for the function call.
@@ -190,8 +195,10 @@ message DeleteStatsProto {
// Delete one document.
SINGLE = 1;
- // Delete by query.
- QUERY = 2;
+ // Delete by query. This value is deprecated.
+ // IcingSearchEngine::DeleteByQuery will return a DeleteByQueryStatsProto
+ // rather than a DeleteStatsProto.
+ DEPRECATED_QUERY = 2 [deprecated = true];
// Delete by namespace.
NAMESPACE = 3;
@@ -205,3 +212,32 @@ message DeleteStatsProto {
// Number of documents deleted by this call.
optional int32 num_documents_deleted = 3;
}
+
+// Stats of the top-level functions IcingSearchEngine::DeleteByQuery.
+// Next tag: 9
+message DeleteByQueryStatsProto {
+ // Overall time used for the function call.
+ optional int32 latency_ms = 1;
+
+ // Number of documents deleted by this call.
+ optional int32 num_documents_deleted = 2;
+
+ // The UTF-8 length of the query string
+ optional int32 query_length = 3;
+
+ // Number of terms in the query string.
+ optional int32 num_terms = 4;
+
+ // Number of namespaces filtered.
+ optional int32 num_namespaces_filtered = 5;
+
+ // Number of schema types filtered.
+ optional int32 num_schema_types_filtered = 6;
+
+ // Time used to parse the query, including 2 parts: tokenizing and
+ // transforming tokens into an iterator tree.
+ optional int32 parse_query_latency_ms = 7;
+
+ // Time used to delete each document.
+ optional int32 document_removal_latency_ms = 8;
+}
diff --git a/proto/icing/proto/persist.proto b/proto/icing/proto/persist.proto
index 77cf987..8d6b372 100644
--- a/proto/icing/proto/persist.proto
+++ b/proto/icing/proto/persist.proto
@@ -22,6 +22,28 @@ option java_package = "com.google.android.icing.proto";
option java_multiple_files = true;
option objc_class_prefix = "ICNG";
+// The type of persistence guarantee that PersistToDisk should provide.
+// Next tag: 3
+message PersistType {
+ enum Code {
+ // Default. Should never be used.
+ UNKNOWN = 0;
+
+ // Only persist the ground truth. A successful PersistToDisk(LITE) should
+ // ensure that no data is lost the next time Icing initializes. This
+ // should be called after each batch of mutations.
+ LITE = 1;
+
+ // Persists all data in internal Icing components. A successful
+ // PersistToDisk(FULL) should not only ensure no data loss like
+ // PersistToDisk(LITE), but also prevent the need to recover internal data
+ // structures the next time Icing initializes. This should be called at
+ // some point before the app terminates.
+ FULL = 2;
+ }
+ optional Code code = 1;
+}
+
// Result of a call to IcingSearchEngine.Persist
// Next tag: 2
message PersistToDiskResultProto {
diff --git a/proto/icing/proto/schema.proto b/proto/icing/proto/schema.proto
index 4188a8c..c611cbf 100644
--- a/proto/icing/proto/schema.proto
+++ b/proto/icing/proto/schema.proto
@@ -197,7 +197,7 @@ message SchemaProto {
}
// Result of a call to IcingSearchEngine.SetSchema
-// Next tag: 4
+// Next tag: 8
message SetSchemaResultProto {
// Status code can be one of:
// OK
@@ -221,6 +221,21 @@ message SetSchemaResultProto {
// documents that fail validation against the new schema types would also be
// deleted.
repeated string incompatible_schema_types = 3;
+
+ // Schema types that did not exist in the previous schema and were added with
+ // the new schema type.
+ repeated string new_schema_types = 4;
+
+ // Schema types that were changed in a way that was backwards compatible and
+ // didn't invalidate the index.
+ repeated string fully_compatible_changed_schema_types = 5;
+
+ // Schema types that were changed in a way that was backwards compatible, but
+ // invalidated the index.
+ repeated string index_incompatible_changed_schema_types = 6;
+
+ // Overall time used for the function call.
+ optional int32 latency_ms = 7;
}
// Result of a call to IcingSearchEngine.GetSchema
diff --git a/proto/icing/proto/search.proto b/proto/icing/proto/search.proto
index afa9126..66fdbe6 100644
--- a/proto/icing/proto/search.proto
+++ b/proto/icing/proto/search.proto
@@ -65,7 +65,7 @@ message SearchSpecProto {
// Client-supplied specifications on what to include/how to format the search
// results.
-// Next tag: 5
+// Next tag: 6
message ResultSpecProto {
// The results will be returned in pages, and num_per_page specifies the
// number of documents in one page.
@@ -102,21 +102,63 @@ message ResultSpecProto {
// has been specified for a schema type, then *all* properties of that schema
// type will be retrieved.
repeated TypePropertyMask type_property_masks = 4;
+
+ // Groupings of namespaces whose total returned results should be
+ // limited together.
+ // Next tag: 3
+ message ResultGrouping {
+ // The namespaces in this grouping.
+ repeated string namespaces = 1;
+
+ // The maximum number of results in this grouping that should be returned.
+ optional int32 max_results = 2;
+ }
+
+ // How to limit the number of results returned per set of namespaces. If
+ // results match for a namespace that is not present in any result groupings,
+ // then those results will be returned without limit.
+ //
+ // Non-existent namespaces will be ignored.
+ //
+ // Example : Suppose that there are four namespaces each with three results
+ // matching the query for "foo". Without any result groupings, Icing would
+ // return the following results:
+ // ["ns0doc0", "ns0doc1", "ns1doc0", "ns3doc0", "ns0doc2", "ns3doc1",
+ // "ns2doc1", "ns3doc2", "ns2doc0", "ns1doc1", "ns2doc2", "ns1doc1"].
+ //
+ // and the following result groupings:
+ // [ { ["namespace0"], 2 }, { ["namespace1", "namespace2"], 2} ]
+ //
+ // The following results will be returned:
+ // ["ns0doc0", "ns0doc1", "ns1doc0", "ns3doc0", "ns3doc1", "ns2doc1",
+ // "ns3doc2"].
+ repeated ResultGrouping result_groupings = 5;
}
// The representation of a single match within a DocumentProto property.
-// Next tag: 6
+// Next tag: 10
message SnippetMatchProto {
- // The position and length within the matched string at which the exact
- // match begins.
- optional int32 exact_match_position = 2;
+ // The index of the byte in the string at which the match begins and the
+ // length in bytes of the match.
+ optional int32 exact_match_byte_position = 2;
+ optional int32 exact_match_byte_length = 3;
- optional int32 exact_match_bytes = 3;
+ // The index of the UTF-16 code unit in the string at which the match begins
+ // and the length in UTF-16 code units of the match. This is for use with
+ // UTF-16 encoded strings like Java.lang.String.
+ optional int32 exact_match_utf16_position = 6;
+ optional int32 exact_match_utf16_length = 7;
- // The position and length of the suggested snippet window.
- optional int32 window_position = 4;
+ // The index of the byte in the string at which the suggested snippet window
+ // begins and the length in bytes of the window.
+ optional int32 window_byte_position = 4;
+ optional int32 window_byte_length = 5;
- optional int32 window_bytes = 5;
+ // The index of the UTF-16 code unit in the string at which the suggested
+ // snippet window begins and the length in UTF-16 code units of the window.
+ // This is for use with UTF-16 encoded strings like Java.lang.String.
+ optional int32 window_utf16_position = 8;
+ optional int32 window_utf16_length = 9;
reserved 1;
}
@@ -176,7 +218,7 @@ message SearchResultProto {
optional StatusProto status = 1;
// The Results that matched the query. Empty if there was an error.
- // Next tag: 3
+ // Next tag: 4
message ResultProto {
// Document that matches the SearchSpecProto.
optional DocumentProto document = 1;
@@ -184,6 +226,10 @@ message SearchResultProto {
// Snippeting information for the document if requested in the
// ResultSpecProto. A default instance, if not requested.
optional SnippetProto snippet = 2;
+
+ // The score that the document was ranked by. The meaning of this score is
+ // determined by ScoringSpecProto.rank_by.
+ optional double score = 3;
}
repeated ResultProto results = 2;
diff --git a/proto/icing/proto/storage.proto b/proto/icing/proto/storage.proto
index 9e952fe..39dab6b 100644
--- a/proto/icing/proto/storage.proto
+++ b/proto/icing/proto/storage.proto
@@ -1,3 +1,17 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
syntax = "proto2";
package icing.lib;
@@ -8,15 +22,43 @@ option java_package = "com.google.android.icing.proto";
option java_multiple_files = true;
option objc_class_prefix = "ICNG";
-// Next tag: 14
+// Next tag: 10
+message NamespaceStorageInfoProto {
+ // Name of the namespace
+ optional string namespace = 1;
+
+ // Number of alive documents in this namespace.
+ optional int32 num_alive_documents = 2;
+
+ // NOTE: We don't have stats on number of deleted documents in a namespace
+ // since we completely erase all data on a document when it's deleted. And we
+ // can't figure out which namespace it belonged to.
+
+ // Number of expired documents in this namespace.
+ optional int32 num_expired_documents = 3;
+
+ // LINT.IfChange(namespace_storage_info_usage_types)
+ // Number of alive documents that have a UsageReport.usage_type reported
+ optional int32 num_alive_documents_usage_type1 = 4;
+ optional int32 num_alive_documents_usage_type2 = 5;
+ optional int32 num_alive_documents_usage_type3 = 6;
+
+ // Number of expired documents that have a UsageReport.usage_type reported
+ optional int32 num_expired_documents_usage_type1 = 7;
+ optional int32 num_expired_documents_usage_type2 = 8;
+ optional int32 num_expired_documents_usage_type3 = 9;
+ // LINT.ThenChange()
+}
+
+// Next tag: 15
message DocumentStorageInfoProto {
- // Number of alive documents.
+ // Total number of alive documents.
optional int32 num_alive_documents = 1;
- // Number of deleted documents.
+ // Total number of deleted documents.
optional int32 num_deleted_documents = 2;
- // Number of expired documents.
+ // Total number of expired documents.
optional int32 num_expired_documents = 3;
// Total size of the document store in bytes. Will be set to -1 if an IO error
@@ -57,7 +99,13 @@ message DocumentStorageInfoProto {
optional int64 namespace_id_mapper_size = 12;
// Number of namespaces seen from the current documents.
+ //
+ // TODO(cassiewang): This isn't technically needed anymore since clients can
+ // get this number from namespace_storage_info. Consider removing this.
optional int32 num_namespaces = 13;
+
+ // Storage information of each namespace.
+ repeated NamespaceStorageInfoProto namespace_storage_info = 14;
}
// Next tag: 5
diff --git a/proto/icing/proto/usage.proto b/proto/icing/proto/usage.proto
index 7f31a2b..eaa2671 100644
--- a/proto/icing/proto/usage.proto
+++ b/proto/icing/proto/usage.proto
@@ -20,13 +20,11 @@ import "icing/proto/status.proto";
option java_package = "com.google.android.icing.proto";
option java_multiple_files = true;
-
option objc_class_prefix = "ICNG";
// Representation of a usage report that is generated from the client and sent
// to Icing.
// Next tag: 5
-// LINT.IfChange
message UsageReport {
// Namespace of the document.
optional string document_namespace = 1;
@@ -37,6 +35,7 @@ message UsageReport {
// Timestamp in milliseconds of when the usage happens.
optional int64 usage_timestamp_ms = 3;
+ // LINT.IfChange
// Next tag: 3
enum UsageType {
// A custom usage type that clients can assign a meaning to. UsageReports of
@@ -50,9 +49,12 @@ message UsageReport {
// Same as above.
USAGE_TYPE3 = 2;
}
+ // LINT.ThenChange(
+ // //depot/google3/icing/store/usage-store.h:UsageScores,
+ // //depot/google3/icing/proto/\
+ // storage.proto:namespace_storage_info_usage_types)
optional UsageType usage_type = 4;
}
-// LINT.ThenChange(//depot/google3/icing/store/usage-store.h:UsageScores)
// Result of a call to IcingSearchEngine.ReportUsage
// Next tag: 2
@@ -64,4 +66,4 @@ message ReportUsageResultProto {
//
// See status.proto for more details.
optional StatusProto status = 1;
-} \ No newline at end of file
+}