You need to wrap your query in a properties-fragment-query clause,ike this:

cts:properties-fragment-query(

cts:search( doc(), cts:properties-fragment-query(
      cts:element-range-query(xs:QName("deliverytime"), "<=", 
xs:date("2011-01-01"))
      ))



See: 
http://docs.marklogic.com/cts:properties-fragment-query?q=properties-fragment-query&v=8.0&api=true


This e-mail and any accompanying attachments are confidential. The information 
is intended solely for the use of the individual to whom it is addressed. Any 
review, disclosure, copying, distribution, or use of this e-mail communication 
by others is strictly prohibited. If you are not the intended recipient, please 
notify us immediately by returning this message to the sender and delete all 
copies. Thank you for your cooperation.

________________________________________
From: [email protected] 
[[email protected]] on behalf of 
[email protected] 
[[email protected]]
Sent: Monday, November 14, 2016 12:51
Date: Mon, 14 Nov 2016 18:50:47 +0000
From: "Fox, David" <[email protected]>
Subject: [MarkLogic Dev General] Range indexes of document properties
To: "[email protected]"
        <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="windows-1252"

Hello,

I am working with a database of text documents. I have extracted some 
structured metadata from these documents and added these values as document 
properties, e.g.:

<prop:properties xmlns:prop="http://marklogic.com/xdmp/property";>
    <deliverytime>2011-07-06T12:45:55.7887784</deliverytime>
</prop:properties>

I wanted to add an element range index for this property, which the 
documentation says is possible even for document properties. So, via the admin 
interface I created an element range index:

[cid:[email protected]]

I then went back to the Configure view for my database and selected 'Reindex.'

Now I would like to confirm that the range index is working, so I tried a few 
different CTS expressions:

A cts:properties-query:

cts:search(doc(), cts:properties-query(
      cts:element-range-query(xs:QName("deliverytime"), "<=",
     xs:date("2011-01-01"))
      ))

An element range query, with xdmp:document-properties() as the expression:

cts:search(xdmp:document-properties(),
      cts:element-range-query(xs:QName("deliverytime"), "<=",
      xs:date("2011-01-01"))
      )

An element range query, with doc() as the expression:

cts:search(doc(),
      cts:element-range-query(xs:QName("deliverytime"), "<=",
     xs:date("2011-01-01")
      ))

It doesn't seem to matter which I try, they all return an error indicating:

No date element range index for deliverytime

Any idea what  I might have missed?

Also, a bonus question:

How might I combine a free text search (against the contents of my text 
documents) with a document properties query like the above, expressed as a 
search:search function?

Thank you,
David
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to