[MarkLogic Dev General] Creating Collections
dlee at epocrates.com
Sat Nov 21 09:39:22 PST 2009
I'm having fun now trying to search 2 documents at once with different
structures (different root elements among other things)
I know I can put them into a directory and search them via
cts:search( cts:directory("/dir/") , ...)
but I was trying to see what else I could do, so I tried this
cts:search( doc("doc1" )/foo/bar | doc("doc2")/spam ,
"of course" that didnt work. (an error about "Not searchable
So what I've done is search twice then combine the results but it causes
all sorts of unnecessary complexity,
let $res := cts:search( ... ) | cts:search( ... )
for example the ordering now isn't by score anymore, so I have to add a
for/order-by to re-order it.
Then the cts:remainder function doesnt work too good
cts:remainder( $res )
returns the remainder of the first search only. So then I have to do
some more fancy stuff to add 2 remainders ...
I bet you can see how this is going .. :)
So I'm looking around for a better way and ran into the collection
concept. Is that how to solve this ? Create a collection ...
then is the collection searchable ?
cts:search( collection("my collection") ... )
then the results would be combined right ?
SO ho DO I create a collection ? The only way so far I've found is
Is that the only/correct way to create collections ? Is there something
on the admin panel that can do it ?
Any pointers to docs that describe collections would be appreciated.
All I could find is some very terse references to them but not how to
actually create and use them.
Thanks for any suggestions !
David A. Lee
Senior Principal Software Engineer
dlee at epocrates.com <mailto:dlee at epocrates.com>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the General