supersteve
supersteve

Reputation: 29

Marklogic TDE columns with property values

I'm trying to find out if it is possible to put document properties into a var like last-modified and use them in a value.
However, nothing seems to be able to access the properties.
I am aware the xpath property expression doesn't work but I've been trying to use xdmp:document-properties which I think is supposed to work according to the documentation.
Has anyone tried something like this?

Upvotes: 1

Views: 112

Answers (2)

Even the MarkLogic xPath extension to the property axis is not supported in TDE. There is no way to use a single template using properties as Mads has explained.

However... Step back and consider if you need the properties fragment. You could possibly consider using the document metadata feature. That content is accessible in the TDE context under https://docs.marklogic.com/xdmp:node-metadata or https://docs.marklogic.com/xdmp:node-metadata-value

Upvotes: 1

Mads Hansen
Mads Hansen

Reputation: 66781

TDE are limited in which functions are available, and the context of what is accessible when indexing a particular fragment.

You cannot extract index information from a properties fragment while a document fragment is being indexed.

However, you can write a template that extracts index information from a properties fragment as it is being indexed, just like any other fragment.

<template xmlns="http://marklogic.com/xdmp/tde">
  <path-namespaces>
    <path-namespace>
      <prefix>prop</prefix>
      <namespace-uri>http://marklogic.com/xdmp/property</namespace-uri>
    </path-namespace>
  </path-namespaces>
  <context>prop:properties</context>
  <rows>
    <row>
      <schema-name>Schema1</schema-name>
      <view-name>View1</view-name>
      <columns>
        <column>
          <name>modified</name>
          <scalar-type>dateTime</scalar-type>
          <val>last-modified</val>
        </column>
      </columns>
    </row>
  </rows>
</template>

Upvotes: 1

Related Questions