I was actually after count of fragment roots (an ancestor element of table)
so that will work great.

 

Thanks,

Gary

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Geert Josten
Sent: Thursday, May 30, 2013 11:16 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] count of element

 

If you add 'table' as fragment root, then this should give an exact count:

 

xdmp:estimate(cts:search(fn:doc()//table, cts:and-query(())))

 

But I can imagine that you don't want to keep table as fragment root
permanently..

 

Kind regards,

Geert

 

Van: [email protected]
[mailto:[email protected]] Namens Gary Larsen
Verzonden: donderdag 30 mei 2013 17:15
Aan: 'MarkLogic Developer Discussion'
Onderwerp: Re: [MarkLogic Dev General] count of element

 

Thanks Clark,

 

This is returning what appear to be reasonable numbers:

 

xdmp:estimate(cts:search(fn:doc(),
cts:document-fragment-query(cts:element-query(xs:QName('table'),cts:and-quer
y(()))), "unfiltered"))

 

Since I'm using fragments, without the cts:document-fragment-query()  the
counts were small.

 

Gary

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Clark Richey
Sent: Thursday, May 30, 2013 11:03 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] count of element

 

What about something like:

 

fn:count(cts:element-query(xs:QName("table"),cts:and-query(())))


--------

Clark D. Richey, Jr.

Technical Director
MarkLogic Corporation

[email protected]

 <https://twitter.com/crichey> @crichey
Cell:  +1 240 252 7507
 <http://www.marklogic.com/> www.marklogic.com

 <http://www.marklogic.com/summit-series/washington-dc> 
This e-mail and any accompanying attachments are confidential. The
information is intended solely for the use of the individual to whom it is
addressed. Any review, disclosure, copying, distribution, or use of this
e-mail communication by others is strictly prohibited. If you are not the
intended recipient, please notify us immediately by returning this message
to the sender and delete all copies. Thank you for your cooperation.

 

On May 30, 2013, at 10:33 AM, Gary Larsen <[email protected]> wrote:

 

This is probably easy but haven't figured it out yet.

 

I'm looking for a query (preferably cts) to return how many times an
element, <table> for example, exists in the database.  The elements would be
located in fragments.

 

Thanks,

Gary

 

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

 

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

Reply via email to