aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/config/documenttypes.def
blob: 53b9d7bafb3837abdaad158e60025dd329384079 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

namespace=document.config

## Whether attempts to set an undefined field should be ignored rather than causing an error
ignoreundefinedfields bool default=false

## Prefer "Vespa 8" format for the "position" type
usev8geopositions bool default=false

## The Id of the documenttype. Must be unique among all document types.
documenttype[].id int

## Specify the name of the document type. Must be unique.
documenttype[].name string

## Version is not used
documenttype[].version int default=0

## Name of header struct defining document header.
documenttype[].headerstruct int

## Specify a document field id. Must be unique within the document type.
documenttype[].bodystruct int default=0

## Specify a document type to inherit (id)
documenttype[].inherits[].id int

## This is the id of a datatype defined in the document.
documenttype[].datatype[].id int

## This is the type of the datatype.
documenttype[].datatype[].type enum {STRUCT, ARRAY, WSET, MAP, ANNOTATIONREF, PRIMITIVE, TENSOR}

## This is the id of the datatype of the element in the array.
documenttype[].datatype[].array.element.id int default=0

## This is the id of the datatype of the key in the map.
documenttype[].datatype[].map.key.id int default=0

## This is the id of the datatype of the value in the map.
documenttype[].datatype[].map.value.id int default=0

## This is the id of the datatype of the key in the wset.
documenttype[].datatype[].wset.key.id int default=0

## Should an update to a nonexistent element cause it to be created
documenttype[].datatype[].wset.createifnonexistent bool default=false

## Should an element in a weighted set be removed if an update changes the weight to 0
documenttype[].datatype[].wset.removeifzero bool default=false

## This is the id of the referenced annotation.
documenttype[].datatype[].annotationref.annotation.id int default=0

## Specify the name of the struct type. Must be unique within documenttype.
documenttype[].datatype[].sstruct.name string default=""

## Version is not used
documenttype[].datatype[].sstruct.version int default=0

## Specify which compression to use if compression is enabled above (0 = NONE, 6 = LZ4)
documenttype[].datatype[].sstruct.compression.type enum {NONE, LZ4} default=NONE

## Specify the compression level to use if compression is enabled
documenttype[].datatype[].sstruct.compression.level int default=0

## Specify the minimum reduction required from compression in order to keep the compressed version (maximum percentage of original size)
documenttype[].datatype[].sstruct.compression.threshold int default=95

## Specify the minimum size before trying compression.
documenttype[].datatype[].sstruct.compression.minsize int default=200

## Specify a struct field name. Must be unique within the struct type.
documenttype[].datatype[].sstruct.field[].name string

## Specify a document field id. If not specified, this is generated by a hash function
documenttype[].datatype[].sstruct.field[].id int

## Specify the datatype of the field. Can only be a type defined in document
## or one of its inherited document types.
documenttype[].datatype[].sstruct.field[].datatype int

## Additional, optional type information which can be changed without
## (necessarily) causing field incompatibility
documenttype[].datatype[].sstruct.field[].detailedtype string default=""

## The id of the annotation type.
documenttype[].annotationtype[].id int

## The name of the annotation type.
documenttype[].annotationtype[].name string

## The contained datatype of the annotation type.
documenttype[].annotationtype[].datatype int default=-1

## The annotation type that this type inherits. (0 or 1 type)
documenttype[].annotationtype[].inherits[].id int

## Field sets
documenttype[].fieldsets{}.fields[] string

## ID of reference type. This is a regular data type, but is kept in its own
## array to avoid polluting the existing datatype array with a new default
## field value.
documenttype[].referencetype[].id int

## Numeric ID of the document type instances of the reference point to.
documenttype[].referencetype[].target_type_id int

## Imported fields (specified outside the document block in the schema)
documenttype[].importedfield[].name string


# Here starts a new model for how datatypes are configured, where
# everything is per document-type, and each documenttype contains the
# datatypes it defines.

# Note: we will include the built-in "document" document
# type that all other doctypes inherit from also, in order
# to get all the primitive and built-in types declared
# with an idx we can refer to.

# Note: indexes are only meaningful as internal references in this
# config; they will typically be sequential (1,2,3,...)  in the order
# that they are generated (but nothing should depend on that).


## Name of the document type. Must be unique.
doctype[].name string

## Index of this type (as a datatype which can be referred to).
doctype[].idx int

## Internal ID of this datatype
doctype[].internalid int

## Specify document types to inherit
doctype[].inherits[].idx int

## Index of struct defining document fields
doctype[].contentstruct int

## Field sets available for this document type
doctype[].fieldsets{}.fields[] string

## Imported fields (specified outside the document block in the schema)
doctype[].importedfield[].name string

# Everything below here is configuration of data types defined by
# this document type.

# Primitive types must be present as built-in static members.

## Index of primitive type
doctype[].primitivetype[].idx int

## The name of this primitive type
doctype[].primitivetype[].name string


# Arrays are the simplest collection type:

## Index of this array type
doctype[].arraytype[].idx int

## Index of the element type this array type contains
doctype[].arraytype[].elementtype int

## Internal ID of this datatype
doctype[].arraytype[].internalid int


# Maps are another collection type:

## Index of this map type
doctype[].maptype[].idx int

## Index of the key type used by this map type
doctype[].maptype[].keytype int

## Index of the key type used by this map type
doctype[].maptype[].valuetype int

## Internal ID of this datatype
doctype[].maptype[].internalid int


# Weighted sets are more complicated;
# they can be considered as an collection
# of unique elements where each element has
# an associated weight:

## Index of this weighted set type
doctype[].wsettype[].idx int

## Index of the element types contained in this weighted set type
doctype[].wsettype[].elementtype int

## Should an update to a nonexistent element cause it to be created
doctype[].wsettype[].createifnonexistent bool default=false

## Should an element in a weighted set be removed if an update changes the weight to 0
doctype[].wsettype[].removeifzero bool default=false

## Internal ID of this datatype
doctype[].wsettype[].internalid int


# Tensors have their own type system

## Index of this tensor type
doctype[].tensortype[].idx int

## Description of the type of the actual tensors contained
doctype[].tensortype[].detailedtype string


# Document references refer to parent documents that a document can
# import fields from:

## Index of this reference data type:
doctype[].documentref[].idx int

## Index of the document type this reference type refers to:
doctype[].documentref[].targettype int

## Internal ID of this datatype
doctype[].documentref[].internalid int


# Annotation types are another world, but are modeled here
# as if they were also datatypes contained inside document types:

## Index of an annotation type.
doctype[].annotationtype[].idx int

## Name of the annotation type.
doctype[].annotationtype[].name string

## Internal id of this annotation type
doctype[].annotationtype[].internalid int

## Index of contained datatype of the annotation type, if any
doctype[].annotationtype[].datatype int default=-1

## Index of annotation type that this type inherits.
doctype[].annotationtype[].inherits[].idx int


# Annotation references are field values referring to
# an annotation of a certain annotation type.

## Index of this annotation reference type
doctype[].annotationref[].idx int

## Index of the annotation type this annotation reference type refers to
doctype[].annotationref[].annotationtype int

## Internal ID of this datatype
doctype[].annotationref[].internalid int


# A struct is just a named collections of fields:

## Index of this struct type
doctype[].structtype[].idx int

## Name of the struct type. Must be unique within documenttype.
doctype[].structtype[].name string

## Index of another struct type to inherit
doctype[].structtype[].inherits[].type int

## Name of a struct field. Must be unique within the struct type.
doctype[].structtype[].field[].name string

## The "field id" - used in serialized format!
doctype[].structtype[].field[].internalid int

## Index of the type of this field
doctype[].structtype[].field[].type int

## Internal ID of this datatype
doctype[].structtype[].internalid int