I’m typing this blind, so I refer your to the documentation. Assuming your have an element attribute range index on entry/@min and entry/@max and these are two separate XML documents:
cts:search(/, cts:element-attribute-range-query(xs:QName(“entry”), “max”, “<“, 200)) cts:search(/, cts:element-attribute-range-query(xs:QName(“entry”), “min”, “>”, 200)) If, these are part of the same document, and you want to extract the nodes out of a document in hand, that’s a little bit of a different query: $doc//entry[@max lt 200]/. And $doc//entry[@min gt 200/. Of course you can combine them: cts:search(/, cts:element-attribute-range-query(xs:QName(“entry”), “max”, “<“, 200))//entry[@min gt 200]/. Etc. This will find all the documents that have a max value less than 200, and within those documents extract the entry fragments that have a max less than 200. Paul Hoehne Senior Consultant MarkLogic Corporation [email protected] mobile: +1 571 830 4735 www.marklogic.com Click http://po.st/hMGDFm to get your free NoSQL For Dummies e-book! From: Dinesh <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Monday, February 2, 2015 at 12:17 PM To: 'MarkLogic Developer Discussion' <[email protected]<mailto:[email protected]>> Subject: Re: [MarkLogic Dev General] MarkLogic Range Query Hello MarkLogic experts, Sorry, one correction in below query/results Could you please advise how to use cts functions for the below sample results using MarkLogic. XML <entry min="100" max="999"> <product>apple</product> </entry> <entry min="1" max="99"> <product>orange</product> </entry> </root> Query: Query 1 : < 200 (Less than) Results should be: apple, orange Query 2 : > 200 (Greater than) Results should be: apple Regards, Dinesh
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
