somewhat related ... there are 2 hidden indexes in MarkLogic;

 xdmp:document (uris enabled)

 xdmp:collection (collection uris enabled)

which you might be able to leverage. The canonical example for these
indexes are as follows; which returns all uris along with their collection;


cts:element-value-co-occurrences(xs:QName("xdmp:collection"),xs:QName("xdmp:document),"map")

as this is hidden, I make no claims on support (as in there is none) ...
but thought it might be useful

hth, Jim Fuller


On Thu, Jan 17, 2013 at 3:44 PM, Michael Sokolov <[email protected]>wrote:

> 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
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to