Do you have the luxury of being able to you can add namespaces to the content such that similarly named elements have different namespaces for searching?
-----Original Message----- From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Florent Georges Sent: Friday, November 12, 2010 6:52 AM To: MarkLogic General ML Subject: [MarkLogic Dev General] CTS search: using a precise path Hi, When using cts:element-value-query, we match any descendent of a given name. Is there any way to restrict the position of a matching element, e.g. to be a grand-child of a given child? Context and example: I am using a CTS search to search through the entire database. Let's say I have documents of the form: <doc> <foo> <bar>...</bar> </foo> <fooz> <baz>...</baz> </fooz> </doc> So if I want to get all doc elements where foo/bar is equal to 'one', I can use the following: cts:search( /doc/foo, cts:element-value-query(xs:QName('bar'), 'one'))/.. If I want the doc elements where foo/bar is equal to 'one' and where fooz/baz is equal to 'two', I can use the following: cts:search( /doc, cts:and-query(( cts:element-value-query(xs:QName('bar'), 'one'), cts:element-value-query(xs:QName('baz'), 'two')))) This search is fine as long as we have bar elements only at the exact position /doc/foo/bar, and as long as we have baz elements only at the position /doc/fooz/baz. If they can be at different locations, then the search will return false positive. I can of course filter them again using plain predicates, but that's really doing twice the same work and that works only if there are not 1 zillion false positive matches. So the questio is: is there anything equivalent to the following, to anchor exactly a match within its parent/ancestor: cts:search( /doc, cts:and-query(( cts:path-value-query('foo/bar', 'one'), cts:path-value-query('fooz/baz', 'two')))) Regards, -- Florent Georges http://fgeorges.org/ _______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general