If by 'current' version you mean the document without a version label (i.e. latest document), use https://docs.marklogic.com/dls:documents-query
Example search for words Pepsi and Coke in the latest documents xquery version "1.0-ml"; import module namespace dls = "http://marklogic.com/xdmp/dls" at "/MarkLogic/dls.xqy"; cts:search(fn:doc(), cts:and-query( (dls:documents-query() , cts:word-query("Pepsi", ("case-insensitive","diacritic-insensitive","wildcarded","lang=en"), 1), cts:word-query("Coke", ("case-insensitive","diacritic-insensitive","wildcarded","lang=en"), 1) ))) ----------------------------------------------------------------------------- David Lee Lead Engineer MarkLogic Corporation [email protected] Phone: +1 812-482-5224 Cell: +1 812-630-7622 www.marklogic.com<http://www.marklogic.com/> From: [email protected] [mailto:[email protected]] On Behalf Of shruti kapoor Sent: Tuesday, December 02, 2014 10:28 AM To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] Is there any way to restrict Marklogic search on specific version of the document.? Hi all, I store managed documents into a specific collection in marklogic through dls library. I want search to include only current version documents. Is there any way to do it using search:search API? I know how to do it using cts:search(). I know one option is to push old versions into different collection and current version into different. Search only on collection with current version. For some reasons I don't want to do this. Are there any other ways of doing it? -- Regards, Shruti Kapoor
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
