Hi Chris,

probably the index:facets function [1] is a solution for you.
The number of distinct-values for each facet depends on the maxcat setting [2].

Note: if the content of your database changes you have to recreate the index.

Kind regards,
Andreas

[1] http://docs.basex.org/wiki/Index_Module#index:facets
[2] http://docs.basex.org/wiki/Options#MAXCATS

Am 20.10.2012 um 13:58 schrieb Christopher Harper:

Hi @ll,

I'm working on an CM/DM solution that uses BaseX as the metadata repository. This isn't my first stab at a DM/CM system just that the XML database portion is new to me…

Now when trying to scale the system up I find that I have created at least one offending query:

count(
distinct-values(
let $item := doc('db')/repository/items/*//object
for $path in $item/paths/path
where starts-with($path/@name, '/Root/Temp/Import/')
return $item/@uuid
)
)

The '*/' could be replaced with 'documents/document' and 'folders', but that would be two separate queries and their individual times would still be offending.

The goal of the query is to list items placed into a certain folder structure represented by items in the database.

This seems like a straight forward query but I'm stumped at trying to get it to perform adequately.

Any suggestions?

/ Chris
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk