Issue with cts:and-query in Marklogic

advongigo

New Member
I have some xml document. The structure of the documents are like this :-\[code\]<?xml version="1.0" encoding="UTF-8"?><patent-assignment> <assignment-record> <correspondent> <name>NORTH AMERICA INTERNATIONAL PATENT OFFIC</name> <address-1>P.O. BOX 506</address-1> <address-2>MERRIFIELD, VA 22116</address-2> </correspondent> </assignment-record> <patent-assignors> <patent-assignor> <assignor-name>TSAI, YU-WEN</name> <execution-date> <date>20050331</date> </execution-date> </patent-assignor> <patent-assignor> <assignor-name>HUANG, CHENG-I</name> <execution-date> <date>20050331</date> </execution-date> </patent-assignor> </patent-assignors> <patent-assignees> <patent-assignee> <assignee-name>FARADAY TECHNOLOGY CORP.</name> <address-1>NO.10-2, LI-HSIN ROAD 1, SCIENCE-BASED INDUSTRIAL PARK</address-1> <city>HSIN-CHU CITY</city> <country-name>TAIWAN</country-name> </patent-assignee> </patent-assignees> </patent-assignment>\[/code\]I have created fields on assignor-name and assignee-name. Now I am running the cts:search query like this:-\[code\]let $query:=cts:and-query(( cts:element-query(xs:QName("pa:assignor-name"), cts:field-word-query("Assignor Name", "apple")), cts:element-query(xs:QName("pa:assignee-name"), cts:field-word-query("Assignee Name", "salix")) ))for $x in cts:search(fn:doc(), $query)return $x\[/code\]where Assignor Name and Assignee Name are names of the fields which I have created. And these fields have assignor-name and assignee-name as their localname respectively. But when I am running this query it is giving me empty sequence. I have also checked my xml documents and documents have data where assignor-name is "apple" and assignee name is "salix" still I am not getting the result. When I run this query only for assignor name or assignee name then I get results but when I combine them into an and-query then I did not get any results. Please help.
 
Back
Top