Thanks Keith
From: [email protected] [mailto:[email protected]] On Behalf Of Keith Breinholt Sent: Tuesday, June 06, 2017 11:33 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] match all values in sequence Yes, it is possible but you will need to structure your query slightly different. By passing all of the values to the cts:element-value-query() as a sequence the default is to return documents wher ANY of the values match. In effect it is an OR relationship when done this way. To only get documents that have all specified values in the specified element use cts:and-query() to wrap individual instances of the cts:element-value-query() like this: cts:and-query(( cts:element-value-query(xs:QName('defaultName'), 'Consumers'), cts:element-value-query(xs:QName('defaultName'), 'Authors'), cts:element-value-query(xs:QName('defaultName'),'Users'), cts:element-value-query(xs:QName('defaultName'), 'Administrators') )) The one caveat is that if there are muiltiple "defaultName" elements this will match if a combination of any of the "defaultName" elements match all instances. We can get more specific if you have more than one "defaultName" element. Give it a try. -Keith From: [email protected] [mailto:[email protected]] On Behalf Of Gary Larsen Sent: Tuesday, June 6, 2017 8:26 AM To: 'General MarkLogic Developer Discussion' <[email protected]> Subject: [MarkLogic Dev General] match all values in sequence Sorry if this is a bit off topic, but is it possible with cts or a predicate to find a document containing elements which match all values in a sequence? For example: cts:element-value-query(xs:QName('defaultName'), ('Consumers','Authors','Users','Administrators')) Thanks, Gary
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
