Hi,
So far I've been successfully using
document("/content/[type]/[id].xml") to efficiently access a document.
This worked because I had both the [type] and the [id] values that
make up the path and the filename.
Now my scenario has changed and I no longer know the [type] bit of the
path. For convenience I still want to store all documents belonging
to a given [type] in the corresponding subdirectory (although this may
be negotiable).
The only way that I've found so far, and which is horribly inefficient
is to look inside the document for the [id] value, like so:
let $doc as node() :=
document(xdmp:node-uri(collection("metadata")/*[dt:identifier = $id]))
A document has a type specific root element (such as Book, Article,
...), and as one if its children the <dt:identifier> element. This
takes consistently longer than a second to execute.
I've considered and rejected creating a specific collection for each
identifier, i.e. I would end up with one collection per element which
seems to be counter the concept of collections which is intended to
regroup documents with common properties.
I appreciate your input.
cheers,
Jakob.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general