Document types
Contents
Introduction
In Explorer data is organized into Collections. Each collection may contain a number of documents. Each document may have fields with values.
Each document must have a specific document-type.
A document type controls the indexing, on a per field level, as well as optional validation rules.
A single collection may have documents with different document types. |
Document types list
The table will show a list of the document types.
Each row represents a document type and will have a button to edit it.
Settings
When creating a new document type, you must define the basic settings:
- Name
-
A unique name which is also an identifier. The name may only contain a strictly limited set of characters.
The name cannot be changed after a document type is created. Deleting a document type after clients have started using it will be a breaking change in the GraphQL API. To prevent breaking the API, a document type should rather be disabled. - Add fields automatically
-
Enable this option if you want the document type to be dynamic. If enabled, whenever a document is created or updated it will automatically detect new fields, determine a Value type for the field and add it to the document type.
Fields
Once a document type has been created, you can manage its fields.
Each row represents a field and will have a button to edit the field, or add new fields.
Fields
- Name
-
Each field must have a unique name within the document type.
The name cannot be changed after a field is created. Deleting a field after clients have started using it will be a breaking change in the GraphQL API. To prevent breaking the API, a field should rather be disabled. Fields can also be nested. A dot '.' is used to indicate nesting. For instance:
person.name
. In this case, the fieldperson
will be reserved for nesting and can no longer be used for indexing. - Value type
-
Each field must have a specific value type. The value type enables field validation and default indexing options.
The value types are:
Boolean
,Double
,geoPoint
,instant
,localDate
,localDateTime
,localTime
,long
,set
andstring
.Value type validation is only enforced if documents are created with validateOccurrences=true. Visit the Enonic XP Value types documentation for more details on value types and indexing.
- Min
-
0 means the field is optional. Setting it to anything larger than 0 means it’s a required field.
The "Min" option is only enforced if documents are created with validateOccurrences=true. - Max
-
0 means there is no limit on how many values the field can have.
The "Max" option is only enforced if documents are created with validateOccurrences=true. - Indexing
-
Enable in order to search this specific field. Enabled by default.
For details on all indexing options, see Config Options. - Include in alltext
-
When enabled, the value of this field will be included in the system defined _alltext field. _alltext typically aggregates all string values in a document, and is the default field used when searching.
- Fulltext
-
When enabled, the field value will be analyzed and enabled for general text search.
- Ngram
-
When enabled, the field value will be analyzed and enabled for ngram search. Ngram is typically used for autocompletion, and "starts with" types of search.
- Path
-
When enabled, the field value will be analyzed and enabled for path search. Paths are strings with / separators.
- Active
-
Deleting a field will potentially break the strongly typed GraphQL API. Deactivating will not break the schema, but simply return empty values for the field instead.
Updating document types
When a document type is in use (one or more documents exist), it is still possible to modify and update the document type.
After saving your changes to the document type, all documents will automatically be re-indexed based on the new document type definition.