xref: /aosp_15_r20/external/googleapis/google/cloud/contentwarehouse/v1/histogram.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.cloud.contentwarehouse.v1;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/api/field_behavior.proto";
20*d5c09012SAndroid Build Coastguard Workerimport "google/api/resource.proto";
21*d5c09012SAndroid Build Coastguard Worker
22*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Cloud.ContentWarehouse.V1";
23*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/contentwarehouse/apiv1/contentwarehousepb;contentwarehousepb";
24*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
25*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "HistogramProto";
26*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.cloud.contentwarehouse.v1";
27*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\ContentWarehouse\\V1";
28*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::ContentWarehouse::V1";
29*d5c09012SAndroid Build Coastguard Worker
30*d5c09012SAndroid Build Coastguard Worker// The histogram request.
31*d5c09012SAndroid Build Coastguard Workermessage HistogramQuery {
32*d5c09012SAndroid Build Coastguard Worker  // An expression specifies a histogram request against matching documents for
33*d5c09012SAndroid Build Coastguard Worker  // searches.
34*d5c09012SAndroid Build Coastguard Worker  //
35*d5c09012SAndroid Build Coastguard Worker  // See
36*d5c09012SAndroid Build Coastguard Worker  // [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries]
37*d5c09012SAndroid Build Coastguard Worker  // for details about syntax.
38*d5c09012SAndroid Build Coastguard Worker  string histogram_query = 1;
39*d5c09012SAndroid Build Coastguard Worker
40*d5c09012SAndroid Build Coastguard Worker  // Controls if the histogram query requires the return of a precise count.
41*d5c09012SAndroid Build Coastguard Worker  // Enable this flag may adversely impact performance.
42*d5c09012SAndroid Build Coastguard Worker  //
43*d5c09012SAndroid Build Coastguard Worker  // Defaults to true.
44*d5c09012SAndroid Build Coastguard Worker  bool require_precise_result_size = 2;
45*d5c09012SAndroid Build Coastguard Worker
46*d5c09012SAndroid Build Coastguard Worker  // Optional. Filter the result of histogram query by the property names. It
47*d5c09012SAndroid Build Coastguard Worker  // only works with histogram query count('FilterableProperties'). It is an
48*d5c09012SAndroid Build Coastguard Worker  // optional. It will perform histogram on all the property names for all the
49*d5c09012SAndroid Build Coastguard Worker  // document schemas. Setting this field will have a better performance.
50*d5c09012SAndroid Build Coastguard Worker  HistogramQueryPropertyNameFilter filters = 3
51*d5c09012SAndroid Build Coastguard Worker      [(google.api.field_behavior) = OPTIONAL];
52*d5c09012SAndroid Build Coastguard Worker}
53*d5c09012SAndroid Build Coastguard Worker
54*d5c09012SAndroid Build Coastguard Workermessage HistogramQueryPropertyNameFilter {
55*d5c09012SAndroid Build Coastguard Worker  // The result of the histogram query count('FilterableProperties') using
56*d5c09012SAndroid Build Coastguard Worker  // HISTOGRAM_YAXIS_DOCUMENT will be:
57*d5c09012SAndroid Build Coastguard Worker  // invoice_id: 2
58*d5c09012SAndroid Build Coastguard Worker  // address: 1
59*d5c09012SAndroid Build Coastguard Worker  // payment_method: 2
60*d5c09012SAndroid Build Coastguard Worker  // line_item_description: 1
61*d5c09012SAndroid Build Coastguard Worker  enum HistogramYAxis {
62*d5c09012SAndroid Build Coastguard Worker    // Count the documents per property name.
63*d5c09012SAndroid Build Coastguard Worker    HISTOGRAM_YAXIS_DOCUMENT = 0;
64*d5c09012SAndroid Build Coastguard Worker
65*d5c09012SAndroid Build Coastguard Worker    // Count the properties per property name.
66*d5c09012SAndroid Build Coastguard Worker    HISTOGRAM_YAXIS_PROPERTY = 1;
67*d5c09012SAndroid Build Coastguard Worker  }
68*d5c09012SAndroid Build Coastguard Worker
69*d5c09012SAndroid Build Coastguard Worker  // This filter specifies the exact document schema(s)
70*d5c09012SAndroid Build Coastguard Worker  // [Document.document_schema_name][google.cloud.contentwarehouse.v1.Document.document_schema_name]
71*d5c09012SAndroid Build Coastguard Worker  // to run histogram query against. It is optional. It will perform histogram
72*d5c09012SAndroid Build Coastguard Worker  // for property names for all the document schemas if it is not set.
73*d5c09012SAndroid Build Coastguard Worker  //
74*d5c09012SAndroid Build Coastguard Worker  // At most 10 document schema names are allowed.
75*d5c09012SAndroid Build Coastguard Worker  // Format:
76*d5c09012SAndroid Build Coastguard Worker  // projects/{project_number}/locations/{location}/documentSchemas/{document_schema_id}.
77*d5c09012SAndroid Build Coastguard Worker  repeated string document_schemas = 1 [(google.api.resource_reference) = {
78*d5c09012SAndroid Build Coastguard Worker    type: "contentwarehouse.googleapis.com/DocumentSchema"
79*d5c09012SAndroid Build Coastguard Worker  }];
80*d5c09012SAndroid Build Coastguard Worker
81*d5c09012SAndroid Build Coastguard Worker  // It is optional. It will perform histogram for all the property names if it
82*d5c09012SAndroid Build Coastguard Worker  // is not set.
83*d5c09012SAndroid Build Coastguard Worker  // The properties need to be defined with the is_filterable flag set to
84*d5c09012SAndroid Build Coastguard Worker  // true and the name of the property should be in the format:
85*d5c09012SAndroid Build Coastguard Worker  // "schemaId.propertyName". The property needs to be defined in the schema.
86*d5c09012SAndroid Build Coastguard Worker  // Example: the schema id is abc. Then the name of property for property
87*d5c09012SAndroid Build Coastguard Worker  // MORTGAGE_TYPE will be "abc.MORTGAGE_TYPE".
88*d5c09012SAndroid Build Coastguard Worker  repeated string property_names = 2;
89*d5c09012SAndroid Build Coastguard Worker
90*d5c09012SAndroid Build Coastguard Worker  // By default, the y_axis is HISTOGRAM_YAXIS_DOCUMENT if this field is not
91*d5c09012SAndroid Build Coastguard Worker  // set.
92*d5c09012SAndroid Build Coastguard Worker  HistogramYAxis y_axis = 3;
93*d5c09012SAndroid Build Coastguard Worker}
94*d5c09012SAndroid Build Coastguard Worker
95*d5c09012SAndroid Build Coastguard Worker// Histogram result that matches
96*d5c09012SAndroid Build Coastguard Worker// [HistogramQuery][google.cloud.contentwarehouse.v1.HistogramQuery] specified
97*d5c09012SAndroid Build Coastguard Worker// in searches.
98*d5c09012SAndroid Build Coastguard Workermessage HistogramQueryResult {
99*d5c09012SAndroid Build Coastguard Worker  // Requested histogram expression.
100*d5c09012SAndroid Build Coastguard Worker  string histogram_query = 1;
101*d5c09012SAndroid Build Coastguard Worker
102*d5c09012SAndroid Build Coastguard Worker  // A map from the values of the facet associated with distinct values to the
103*d5c09012SAndroid Build Coastguard Worker  // number of matching entries with corresponding value.
104*d5c09012SAndroid Build Coastguard Worker  //
105*d5c09012SAndroid Build Coastguard Worker  // The key format is:
106*d5c09012SAndroid Build Coastguard Worker  //
107*d5c09012SAndroid Build Coastguard Worker  // * (for string histogram) string values stored in the field.
108*d5c09012SAndroid Build Coastguard Worker  map<string, int64> histogram = 2;
109*d5c09012SAndroid Build Coastguard Worker}
110