Hi Santhosh, Relevance order is an order determined using tf/idf (or one of the other relevance algorithms), and is based on the term frequency of terms you are searching for. The most relevant document will return at the beginning of the results. This is the classic search algorithm, and cts:search expressions return in relevance order.
XPath returns in document order. XML documents have order implied in their structure, and XPath requires that this order be maintained. You can later change the order of a sequence that is the result of an XPath by doing an order by (with a FLWOR). When you have multiple documents that return from an XPath expression, that order is known as document order (what Kelly was referring to as database order). The actual order of document order is "implementation defined", which means that the spec does not dictate the order, but does dictate that given a steady-state of the database, it will be consistent. XPath will preserve document order. Does that expain it? -Danny From: [email protected] [mailto:[email protected]] On Behalf Of Santhosh Raj Sent: Monday, May 18, 2009 5:34 AM To: General Mark Logic Developer Discussion Subject: Re: [MarkLogic Dev General] RE: How to search plural documents by Hi kelly, What is database order and relevance order? what is the difference? Santhosh Rajasekaran Tata Consultancy Services Mailto: [email protected] Website: http://www.tcs.com<http://www.tcs.com/> ____________________________________________ Experience certainty. IT Services Business Solutions Outsourcing ____________________________________________ Kelly Stirman <[email protected]> Sent by: [email protected] 05/18/2009 05:21 PM Please respond to General Mark Logic Developer Discussion <[email protected]> To "[email protected]" <[email protected]> cc 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 ForwardSourceID:NT0000BACA =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
