Hi Pragya,

If you store the entire document list in one document fragment, indexing won’t 
help anyhow. Best would be to split at Document element, and store those as 
separate documents in the database. Next, you can either annotate the XML with 
an attribute containing an iso-formatted xs:date string for a date type index, 
or you could put such a value in a document property. The latter comes with 
extra overhead though. You could also put separate int range indexes on 
year/month/day, but the query would have to be fully decomposed, and would 
perform worse. In cts:parse language:

year EQ 2015 AND ((month GT 8 OR month LT 12) OR (month EQ 8 AND day GE 29) OR 
(month EQ 12 AND day LE 3))

Cheers,
Geert

From: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of "Kapoor, Pragya" 
<pkapo...@innodata.com<mailto:pkapo...@innodata.com>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Wednesday, March 30, 2016 at 9:56 AM
To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Subject: [MarkLogic Dev General] Attribute Range index



Hi,


I have an xml in which date is stored as below:

 <Date Year="2015" Month="11" Day="25">2015 Nov 25</Date>


Now I need to search for those elements in the xml those date falls between D1 
and D2

where D1 = 2015-08-29 and D2 = 2015-12-03


sample XML( this is a big file,I have just taken few elements here) :


<DocumentList>
    <Document>
        <DocumentType>AM</DocumentType>
        <ID>/docs/123.xml</ID>
        <Number>0005002</Number>
        <Date Year="2015" Month="11" Day="20">2015 Nov 20</Date>
       </Document>
    <Document>
        <DocumentType>AM</DocumentType>
        <ID>/docs/3456.xml</ID>
        <Number>0005002</Number>
        <Date Year="2016" Month="02" Day="25">2015 Nov 25</Date>
    </Document>
    <Document>
        <AddedToSynopsysDate>2016-02-18T20:17:54.674+05:30</AddedToSynopsysDate>
        <DocumentType>AM</DocumentType>
        <ID>/docs/678.xml</ID>
        <Number>0005002</Number>
        <Date Year="2015" Month="11" Day="30">2015 Nov 30</Date>
    </Document>
<DocumentList>

Do I need to create attribute range index for each (year, month and date)
Could you please help on this?

Note: We cant change the format in which the date is stored in the xml.

Thanks
Pragya


"This e-mail and any attachments transmitted with it are for the sole use of 
the intended recipient(s) and may contain confidential , proprietary or 
privileged information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. Any 
unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this e-mail or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful."
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to