[MarkLogic Dev General] count of element

Gary Larsen gary.larsen at envisn.com
Thu May 30 08:40:38 PDT 2013


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

 

Thanks,

Gary

 

From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] 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: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] 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: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] 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

Clark.Richey at marklogic.com

 <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 <gary.larsen at envisn.com> 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:General at developer.marklogic.com> General at developer.marklogic.com
 <http://developer.marklogic.com/mailman/listinfo/general>
http://developer.marklogic.com/mailman/listinfo/general

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20130530/0f6b691e/attachment.html 


More information about the General mailing list