David, That's perfect and is the normal way to find "facet" counts. search:search() is higher-level, but underneath it uses similar calls. There are some tricks to force parallel evaluation which you get for free with search:search().
Damon From: [email protected] [mailto:[email protected]] On Behalf Of David Lee Sent: Tuesday, April 10, 2012 11:25 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Count the number of documents in each range entry. This appears to run very quickly ... any suggestions for improvement ? for $state in cts:element-values( xs:QName("State") ) return ($state , cts:frequency($state) ) ----------------------------------------------------------------------------- David Lee Lead Engineer MarkLogic Corporation [email protected] Phone: +1 650-287-2531 Cell: +1 812-630-7622 www.marklogic.com<http://www.marklogic.com/> 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. From: [email protected] [mailto:[email protected]] On Behalf Of David Lee Sent: Tuesday, April 10, 2012 11:09 AM To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] Count the number of documents in each range entry. Suppose I have a lot of documents with a State element. I would like a list of all states and the corresponding number of documents in that state. I can write a FLOWR statement to do this but I believe there is a direct query to do this efficiently. Any suggestions ? ----------------------------------------------------------------------------- David Lee Lead Engineer MarkLogic Corporation [email protected] Phone: +1 650-287-2531 Cell: +1 812-630-7622 www.marklogic.com<http://www.marklogic.com/> 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.
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
