Try creating a path range index on a reasonably expansive path, e.g. 
/doc/(prices|cost)/*". Then you can query like any other range index. You can 
use cts:valid-index-path("/doc/(prices|cost)/*", false()) to validate that your 
path can be used in a range index.

Justin

On Oct 28, 2014, at 4:15 PM, Gary Russo <[email protected]> wrote:

> I have a database that consists of highly unstructured documents. The 
> documents contain pricing data.
>  
> My requirement is to search all nodes of every document to find a number that 
> is greater than 1,000.
>  
> The element names containing the numbers can be anything.
>  
> Example Docs:
>  
> Doc 1
>  
> <doc>
>   <prices>
>     <beginningBalance>250</beginningBalance>
>     <endingBalance>9996.26426957374</endingBalance>
>   </prices>
>   <summary>
>     <summary-as>Public Law</summary-as>
>     <summary-date>2012-02-14</summary-date>
>     <summary-text>Redesignates the Noxubee National Wildlife 
> Refuge.....</summary-text>
>   </summary>
>   <bankCharge>1500.75</bankCharge>
> </doc>
> 
>  
> Doc 2
>  
> <doc>
>   <cost>
>     <startBalance>250</startBalance>
>     <endBalance>9996.26426957374</endBalance>
>   </cost>
>   <summary>
>     <summary-as>Public Law</summary-as>
>     <summary-date>2012-02-14</summary-date>
>   </summary>
>   <bankFee>1500.75</bankFee>
> </doc>
> 
>  
> I can use a brute force XQuery code snippet like the following but I’d like 
> to use the universal index.
>  
> What is the recommended approach for something like this?
>  
>  
> Brute Force XQuery:
>  
> let $values :=
>   for $n in $doc1//node()/*/text()
>     let $value := try { xs:float($n) } catch ($e) { () }
>     where $value gt 1000
>       return
>         $value||" | "||xdmp:path($n)
> return $values
>  
>  
>  
>  
> Gary Russo
> Enterprise NoSQL Developer
> http://garyrusso.wordpress.com
>  
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to