Hi Kelly,
Thank you for your kind reply. I surely succeeded in doing search against
plural documents by using XPath.
Thanks,
Yasumasa
----- Original Message -----
From: "Kelly Stirman" <[email protected]>
To: <[email protected]>
Sent: Monday, May 18, 2009 8:51 PM
Subject: [MarkLogic Dev General] RE: How to search plural documents by
XPath expressions are evaluated against all documents in a MarkLogic
database:
/foo/bar
Will return all elements bar that are children of documents with a root node
of foo.
collection("my-collection")/foo/bar
Will return all elements bar that are children of documents with a root node
of foo that belong to the collection "my-collection."
xdmp:directory("/my-directory/","infinity")/foo/bar
Will return all elements bar that are children of documents with a root node
of foo that are in a directory called "/my-directory/" or any of its
descendent directories.
One difference between cts:search() and XPath is the ordering of documents.
XPath returns documents in database order, whereas cts:search() returns
documents in relevance order. It is possible to order your expressions by
other values, but to do that you will need a FLWOR expression.
Finally, you can add cts:query constraints to your XPath expressions using
cts:contains():
xdmp:directory("/my-directory/","infinity")/foo/bar[cts:contains(.,cts:and-query(("blue","red")))]
Will return all elements bar that are children of documents with a root node
of foo that contain the words "red" and "blue" that are in a directory
called "/my-directory/" or any of its descendent directories. Results will
be returned in database order.
Hope this helps.
Kelly
Message: 3
Date: Mon, 18 May 2009 20:38:23 +0900
From: "Yasumasa Shigemoto" <[email protected]>
Subject: [MarkLogic Dev General] How to search plural documents by
using XPath.
To: <[email protected]>
Message-ID: <7d68896c51664e35b4ad353578276...@fbio001742bf1332>
Content-Type: text/plain; format=flowed; charset="iso-2022-jp";
reply-type=original
Hi all,
I have used MarkLogic for two weeks, and I have managed to use XQuery
against one XML document. And I could also use cts:search against plural XML
documents. However I would like to search against plural documents by using
XPath. Can I do it by using both cts:search and XQuery? If yes, could you
tell me the examples of XQuery and XML documents?
Thanks and regards,
------------------------------
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
End of General Digest, Vol 59, Issue 21
***************************************
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general