Yeah - thanks Geert and Damon: I think you've confirmed for me that there is no directory-faceting as such, but that I can process all the matching uris, which was going to be my fallback. My guess is this should be acceptable for < 100K matches or so
-Mike On 1/17/2013 12:37 AM, Damon Feldman wrote: > Mike, > > This is moderately efficient, so may work depending on your use case and the > number of matching uris: > > declare namespace functx = "http://www.functx.com"; > declare function functx:substring-before-last-fslash($arg as xs:string?) as > xs:string? { > > let $dir := replace($arg, '^(.*)/.*', '$1') > return if (ends-with($dir, "/")) then $dir else () (: if there is no / at > all, the replace will have no effect, so check the terminating slash to > ensure it is a directory :) > > } ; > > let $q := ... some query ... > distinct-values(cts:uris("", (), $q) ! > functx:substring-before-last-fslash(.)) > > Note the "!" operator is a shorthand for a for loop in ML 6. Note the > function is based on functx, but has the "/" delimiter hard-coded. > > Yours, > Damon > -- > Damon Feldman > Sr. Principal Consultant, MarkLogic > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Michael Sokolov > Sent: Wednesday, January 16, 2013 10:38 PM > To: General Developer Discussion > Subject: [MarkLogic Dev General] directory facet? > > Is there an efficient way to retrieve all the directories containing the > documents matching a query, in the way that cts:words does for words? > > -Mike > > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
