I tried a simple test.

I created the index as

type: dateTime
parent namespace uri: http://www.incisivemedia.com/summary
parent localname:  PUBLICATION-DATE
namespace uri:
localname:  datetime
range value positions:  false
invalid values:  reject.

and inserted those two documents.

Then,

let $element-name := fn:QName ('http://www.incisivemedia.com/summary',
'PUBLICATION-DATE')
let $attribute-name := fn:QName ('', 'datetime')
let $ref := cts:element-attribute-reference ($element-name, $attribute-name)
return cts:values ($ref)

returns the two datetime values

2017-08-09T15:14:00
2017-09-21T13:47:00

and a query like

let $element-name := fn:QName ('http://www.incisivemedia.com/summary',
'PUBLICATION-DATE')
let $attribute-name := fn:QName ('', 'datetime')
return
cts:uris ((), (),
    cts:element-attribute-range-query($element-name, $attribute-name,
'>', fn:current-dateTime () - xs:dayTimeDuration('P10D'))
)

returns the uris depending on how many days I subtract.

Does this work for you too (I tested on 9.0-2)?

On Fri, Sep 22, 2017 at 5:02 PM, Kari Cowan <[email protected]> wrote:
> Let me get your opinion on this.  I confirmed that there IS a dateTime
> element-attribute range index.
>
> Where the query works correctly, the data is written like this
> representation:
>
> <DOC-SUMMARY xmlns="http://www.incisivemedia.com/summary";>
> <PUBLICATION-DATE date="2017-08-09"
> datetime="2017-08-09T15:14:00-04:00">2017-08-09
> 15:14:00:000</PUBLICATION-DATE>
> </DOC-SUMMARY>
>
> Where it fails, the data is written this way - note the namespace precedes
> the declaration - which seems wrong to me.
>
> If it's right or wrong, can you advise if that needs to be updated or if
> there's a way to run the query to check a date range, returning docs within
> say the last 10 days only?
>
> <summary:DOC-SUMMARY xmlns:summary="http://www.incisivemedia.com/summary";>
> <summary:PUBLICATION-DATE date="2017-09-21"
> datetime="2017-09-21T17:47:00Z">2017-09-21T17:47:00Z</summary:PUBLICATION-DATE>
> </summary:DOC-SUMMARY>
>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to