Note that it seems that using the asterisk wildcard for last-name setting the 
last-name value is problematic.  Supplying an unused value such as “Uncle Bob” 
returns a result.

 

Tim

From: [email protected] 
[mailto:[email protected]] On Behalf Of Tim Meagher
Sent: 15 December 2016 11:27 AM
To: 'MarkLogic Developer Discussion' <[email protected]>
Subject: [MarkLogic Dev General] cts;and-not-query working as expected

 

Hi folks,

 

The following query is looking for a record that contains a first but not last 
name. The last name may or may not have an element associated with it.  While I 
believe I am using the proper syntax, I think the problem is due to the 
fragment-oriented nature of using cts:and-not-query(), so I’m asking what 
configuration needs to be in place. Note that child and parent elements share 
the same sub-elements of first-name and last-name, hence the use of 
cts:element-query, but there is only one child element per record  I have tried 
the following to no avail:

 

cts:search(/record,
    cts:element-query(xs:QName("child"), cts:and-not-query(
        cts:element-value-query(xs:QName("first-name"), ("*")),
        cts:element-value-query(xs:QName("last-name"), ("*"))
    ))
)

cts:search(/record,
    cts:element-query(xs:QName("child"), cts:and-not-query(
        cts:element-value-query(xs:QName("first-name"), ("*")),
        cts:element-query(xs:QName("last-name"), cts:and-query(()))
    ))
)

Do I need to create a fragment root for /record and add range indexes for 
child, first-name, and last-name?

 

Thanks for any help with this!

 

Tim Meagher

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to