Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue with cts:and-query in Marklogic
    text
    copied!<p>I have some xml document. The structure of the documents are like this :-</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;patent-assignment&gt; &lt;assignment-record&gt; &lt;correspondent&gt; &lt;name&gt;NORTH AMERICA INTERNATIONAL PATENT OFFIC&lt;/name&gt; &lt;address-1&gt;P.O. BOX 506&lt;/address-1&gt; &lt;address-2&gt;MERRIFIELD, VA 22116&lt;/address-2&gt; &lt;/correspondent&gt; &lt;/assignment-record&gt; &lt;patent-assignors&gt; &lt;patent-assignor&gt; &lt;assignor-name&gt;TSAI, YU-WEN&lt;/name&gt; &lt;execution-date&gt; &lt;date&gt;20050331&lt;/date&gt; &lt;/execution-date&gt; &lt;/patent-assignor&gt; &lt;patent-assignor&gt; &lt;assignor-name&gt;HUANG, CHENG-I&lt;/name&gt; &lt;execution-date&gt; &lt;date&gt;20050331&lt;/date&gt; &lt;/execution-date&gt; &lt;/patent-assignor&gt; &lt;/patent-assignors&gt; &lt;patent-assignees&gt; &lt;patent-assignee&gt; &lt;assignee-name&gt;FARADAY TECHNOLOGY CORP.&lt;/name&gt; &lt;address-1&gt;NO.10-2, LI-HSIN ROAD 1, SCIENCE-BASED INDUSTRIAL PARK&lt;/address-1&gt; &lt;city&gt;HSIN-CHU CITY&lt;/city&gt; &lt;country-name&gt;TAIWAN&lt;/country-name&gt; &lt;/patent-assignee&gt; &lt;/patent-assignees&gt; &lt;/patent-assignment&gt; </code></pre> <p>I have created fields on <code>assignor-name</code> and <code>assignee-name</code>. Now I am running the <code>cts:search</code> query like this:-</p> <pre><code>let $query:=cts:and-query(( cts:element-query(xs:QName("assignor-name"), cts:field-word-query("Assignor Name", "apple")), cts:element-query(xs:QName("assignee-name"), cts:field-word-query("Assignee Name", "salix")) )) for $x in cts:search(fn:doc(), $query) return $x </code></pre> <p>where Assignor Name and Assignee Name are names of the fields which I have created. And these fields have <code>assignor-name</code> and <code>assignee-name</code> 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 <code>assignor-name</code> is "apple" and <code>assignee-name</code> 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 <code>and-query</code> then I did not get any results. Please help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload