Hi Danny,
Thanks for the clarification. It did appear the field solution would be the simplest. gary From: [email protected] [mailto:[email protected]] On Behalf Of Danny Sokolsky Sent: Tuesday, July 19, 2011 1:02 PM To: General MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Question on fields Hi Gary, You have the right idea with the field, but field will put a space between tokens in different elements, so the value to search for would be "deny execute". I would not say that fragments will negatively affect performance necessarily, but they should be used with care. Here is an example that shows the way the field works (you will see a match for the space-separated string, and no match for the concatenated one): xquery version "1.0-ml"; (: have a field named "gary" that includes "Permission" :) xdmp:document-insert("/gary.xml", <permissions> <Permission> <access>deny</access> <name>execute</name> </Permission> <Permission> <access>grant</access> <name>traverse</name> </Permission> </permissions>) ; xdmp:estimate( cts:search(fn:doc("/gary.xml"), cts:field-word-query("gary", "deny execute")) ), xdmp:estimate( cts:search(fn:doc("/gary.xml"), cts:field-word-query("gary", "denyexecute")) ) -Danny From: [email protected] [mailto:[email protected]] On Behalf Of Gary Larsen Sent: Tuesday, July 19, 2011 9:44 AM To: 'General MarkLogic Developer Discussion' Subject: Re: [MarkLogic Dev General] Question on fields Me again. In addition I've read that sub-fragments can negatively affect performance (the Permission fragment would be a descendant in a SecurityObject fragment). Is this true? gary From: [email protected] [mailto:[email protected]] On Behalf Of Gary Larsen Sent: Tuesday, July 19, 2011 12:36 PM To: 'General MarkLogic Developer Discussion' Subject: [MarkLogic Dev General] Question on fields I need to filter on the data structure below using a combination of both the <name> and <access> values. <permissions> <Permission> <access>deny</access> <name>execute</name> </Permission> <Permission> <access>grant</access> <name>traverse</name> </Permission> </permissions> It seems one way to accomplish this is to create a fragment root on the Permission element. (This would create very large number of fragments.) I also thought that a field defined on the Permission element (the only include, no excludes) would work - as long as the descendant values were always appended in order. For example: cts:field-word-query('permissionField', 'denyexecute') Can I rely on that? Are there other possible solutions? Thanks, gary
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
