You could leverage search:search to get it back as if it were just another facet, but you’d be typing a lot more, just for the facet definition, and under the hood, any strategy would end up doing exactly what you are doing already I guess. Your approach is essentially the way to go.
Kind regards, Geert *Van:* [email protected] [mailto: [email protected]] *Namens *David Lee *Verzonden:* dinsdag 10 april 2012 17:25 *Aan:* MarkLogic Developer Discussion *Onderwerp:* 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 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 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
