xref: /aosp_15_r20/external/googleapis/google/cloud/contentwarehouse/v1/histogram.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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 = "proto3";
16
17package google.cloud.contentwarehouse.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21
22option csharp_namespace = "Google.Cloud.ContentWarehouse.V1";
23option go_package = "cloud.google.com/go/contentwarehouse/apiv1/contentwarehousepb;contentwarehousepb";
24option java_multiple_files = true;
25option java_outer_classname = "HistogramProto";
26option java_package = "com.google.cloud.contentwarehouse.v1";
27option php_namespace = "Google\\Cloud\\ContentWarehouse\\V1";
28option ruby_package = "Google::Cloud::ContentWarehouse::V1";
29
30// The histogram request.
31message HistogramQuery {
32  // An expression specifies a histogram request against matching documents for
33  // searches.
34  //
35  // See
36  // [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries]
37  // for details about syntax.
38  string histogram_query = 1;
39
40  // Controls if the histogram query requires the return of a precise count.
41  // Enable this flag may adversely impact performance.
42  //
43  // Defaults to true.
44  bool require_precise_result_size = 2;
45
46  // Optional. Filter the result of histogram query by the property names. It
47  // only works with histogram query count('FilterableProperties'). It is an
48  // optional. It will perform histogram on all the property names for all the
49  // document schemas. Setting this field will have a better performance.
50  HistogramQueryPropertyNameFilter filters = 3
51      [(google.api.field_behavior) = OPTIONAL];
52}
53
54message HistogramQueryPropertyNameFilter {
55  // The result of the histogram query count('FilterableProperties') using
56  // HISTOGRAM_YAXIS_DOCUMENT will be:
57  // invoice_id: 2
58  // address: 1
59  // payment_method: 2
60  // line_item_description: 1
61  enum HistogramYAxis {
62    // Count the documents per property name.
63    HISTOGRAM_YAXIS_DOCUMENT = 0;
64
65    // Count the properties per property name.
66    HISTOGRAM_YAXIS_PROPERTY = 1;
67  }
68
69  // This filter specifies the exact document schema(s)
70  // [Document.document_schema_name][google.cloud.contentwarehouse.v1.Document.document_schema_name]
71  // to run histogram query against. It is optional. It will perform histogram
72  // for property names for all the document schemas if it is not set.
73  //
74  // At most 10 document schema names are allowed.
75  // Format:
76  // projects/{project_number}/locations/{location}/documentSchemas/{document_schema_id}.
77  repeated string document_schemas = 1 [(google.api.resource_reference) = {
78    type: "contentwarehouse.googleapis.com/DocumentSchema"
79  }];
80
81  // It is optional. It will perform histogram for all the property names if it
82  // is not set.
83  // The properties need to be defined with the is_filterable flag set to
84  // true and the name of the property should be in the format:
85  // "schemaId.propertyName". The property needs to be defined in the schema.
86  // Example: the schema id is abc. Then the name of property for property
87  // MORTGAGE_TYPE will be "abc.MORTGAGE_TYPE".
88  repeated string property_names = 2;
89
90  // By default, the y_axis is HISTOGRAM_YAXIS_DOCUMENT if this field is not
91  // set.
92  HistogramYAxis y_axis = 3;
93}
94
95// Histogram result that matches
96// [HistogramQuery][google.cloud.contentwarehouse.v1.HistogramQuery] specified
97// in searches.
98message HistogramQueryResult {
99  // Requested histogram expression.
100  string histogram_query = 1;
101
102  // A map from the values of the facet associated with distinct values to the
103  // number of matching entries with corresponding value.
104  //
105  // The key format is:
106  //
107  // * (for string histogram) string values stored in the field.
108  map<string, int64> histogram = 2;
109}
110