Off the top of my head, that seems reasonable (especially if it is performing 
well).  I would use an empty and-query (which matches everything in the db) 
instead of the "*" though:

cts:uris((),'document', 
  cts:element-query(xs:QName('ElementA'), 
    cts:element-query(xs:QName('ElementB'), cts:and-query( () ))
  )
)

You will probably want to have positions and element positions enabled in the 
database configuration.

-Danny

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Whitby, Rob, CMG
Sent: Thursday, October 15, 2009 4:20 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Best way to get URIs of docs containing 
certain elements?

Hi

I need to get a list of URIs of documents which contain <ElementA> with
child <ElementB>:

for $doc in fn:doc()[//ElementA//ElementB]
return fn:document-uri($doc)


What is the quickest way of achieving this? At the moment I've got:

cts:uris((),'document', 
  cts:element-query(xs:QName('ElementA'), 
    cts:element-query(xs:QName('ElementB'), '*')
  )
)

It doesn't feel like a very good solution though, any better ideas?

Thanks
Rob



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

Reply via email to