Search code examples
marklogictde

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?


Solution

  • 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>