• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2024 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
19option java_package = "com.google.android.icing.internal.proto";
20option java_multiple_files = true;
21option objc_class_prefix = "ICNG";
22
23// Message that contains the data payload of a scorable property.
24//
25// Next tag: 4
26message ScorablePropertyProto {
27  // The following three fields should be treated as oneof.
28  repeated int64 int64_values = 1 [packed = true];
29  repeated double double_values = 2 [packed = true];
30  repeated bool boolean_values = 3 [packed = true];
31}
32
33// Message that contains a set of scorable properties derived from a document
34// proto. This will be stored in the icing document store to allow faster
35// access of scorable properties during the scoring/ranking phase.
36//
37// Use icing::lib::scorable_property_set.h to build/interpret this proto.
38//
39// See go/appsearch-docjoin-dd for the design doc.
40//
41// Next tag: 2
42message ScorablePropertySetProto {
43  // The order of the properties in this proto should match the lexicographical
44  // order of the scorable properties paths in the schema proto.
45  //
46  // All values under a property path will be merged into a list.
47  //
48  // For example, if you have a schema like:
49  //   SchemaBuilder()
50  //     .AddType(
51  //       SchemaTypeConfigBuilder()
52  //         .setType('person')
53  //           .AddProperty('name')                 // not scorable
54  //           .AddProperty('age')                  // scorable
55  //           .AddProperty('address')              // not scorable
56  //           .AddProperty('income'))              // scorable
57  //     .AddType(
58  //       SchemaTypeConfigBuilder()
59  //         .setType('email')
60  //           .AddProperty('subject')              // not scorable
61  //           .AddProperty('importance')           // scorable
62  //           .AddProperty('title')                // not scorable
63  //           .AddProperty('score')                // scorable
64  //           .AddDocumentProperty('receiver'))    // scorable, person type
65  //           .AddDocumentProperty('sender'))      // scorable, person type
66  //
67  // And an email document like:
68  //   Document email_document {
69  //     schema: 'email'
70  //     properties: {
71  //       name: 'subject'
72  //       string_values: 'foo'
73  //     }
74  //     properties: {
75  //       name: 'score'
76  //       double_values: [1.5, 2.5, 3.5]
77  //     }
78  //     properties: {
79  //       name: 'receiver
80  //       document_values: {
81  //         properties: {
82  //           name: 'age'
83  //           int64_values: [30]
84  //         }
85  //         properties: {
86  //           name: 'income'
87  //           double_values: [10000, 20000]
88  //         }
89  //         properties: {
90  //           name: 'isStarred'
91  //           boolean_values: [true]
92  //         }
93  //       }
94  //       document_values: {
95  //         properties: {
96  //           name: 'age'
97  //           int64_values: [40]
98  //         }
99  //         properties: {
100  //           name: 'income'
101  //           double_values: [30000, 40000]
102  //         }
103  //         properties: {
104  //           name: 'isStarred'
105  //           boolean_values: [false]
106  //         }
107  //       }
108  //     }
109  //   }
110  //
111  // When email_document is put into the icing document store, the following
112  // proto will be generated and stored in icing:
113  // {
114  //   # For the 'importance' property
115  //   properties: {}
116  //   # For the 'receiver.age' property
117  //   properties: {
118  //     int64_values: [30, 40]
119  //   }
120  //   # For the 'receiver.income' property
121  //   properties: {
122  //     double_values: [10000, 20000, 30000, 40000]
123  //   }
124  //   # For the 'receiver.isStarred' property
125  //   properties: {
126  //     boolean_values: [true, false]
127  //   }
128  //   # For the 'score' property
129  //   properties: {
130  //     double_values: [1.5, 2.5, 3.5]
131  //   }
132  //   # For the 'sender.age' property
133  //   properties: {}
134  //   # For the 'sender.income' property
135  //   properties: {}
136  //   # For the 'sender.isStarred' property
137  //   properties: {}
138  // }
139  //
140  // During the scoring/ranking phase, the implicit property order can be used
141  // to lookup the property's name from the schema store.
142  repeated ScorablePropertyProto properties = 1;
143}
144