Metadata Fields
Metadata fields are used by temporal documents to store valid and system timestamps and archival information, as described in the Temporal Developer’s Guide. You can also use this capability to associate user-defined key-value metadata with non-temporal documents. Metadata fields are sometimes referred to as just “metadata” or as “key-value metadata”.
Metadata fields differ from root and path fields in that they do not define elements to be included or excluded from search. Instead, metadata fields define key/value combinations that are associated with a document, but stored outside of that document.
To search this type of metadata, you must explicitly create a field based on the metadata key you want to be able to search. For details on configuring a metadata field, see Configuring a New Metadata Field.
Metadata fields can be operated on using any API function that takes a field. For example, you can do all of the following operations on a metadata field:
Query using a
cts:field-word-query
andcts:field-value-query
function.Create a word lexicon on a metadata field and use it in a
cts:field-words
andcts:field-word-match
function.Create a range index on a metadata field and use it in a
cts:field-range-query
,cts:field-values
,cts:field-value-match
, andcts:field-value-ranges
function.Make a range index reference for a metadata field range index and use it in a
cts:values
,cts:value-match
,cts:value-ranges
,cts:value-co-occurrences
,cts:value-tuples
andcts:ordering
function.Configure tokenizer-overrides.
Configure stemmed-searches.
Configure word-searches.
Configure field-value-searches.
Configure fast-phrase-searches.
Configure fast-case-sensitive-searches.
Configure fast-diacritic-sensitive-searches.
Configure trailing-wildcard-searches.
Configure three-character-searches.
Configure two-character-searches.
Configure one-character-searches.
Metadata for temporal documents is managed by the temporal APIs, as described in Managing Temporal Documents in the Temporal Developer’s Guide. For non-temporal documents, metadata can be inserted along with the document by the xdmp.documentInsert
or xdmp.documentLoad
function. You can add or modify document metadata using the xdmp.documentPutMetadata
and xdmp.documentSetMetadata
functions. Document metadata can be returned using the xdmp.documentGetMetadata
and xdmp.documentGetMetadataValue
functions.
Metadata can also be associated with a document node. Node metadata is managed by means of the xdmp.nodeMetadata
and xdmp.nodeMetadataValue
functions.