Hi Ashutosh,

Did you look into Phrase-Throughs, and Element-Word-Query-Throughs?

Kind regards,
Geert

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Ashutosh Trivedi 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Tuesday, October 20, 2015 at 9:05 AM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Search for Sub Tag Text

Hi,

I am trying to search below xml  document which contains co2 in which 2 is sub 
tags of the text co2  highlighted in yellow.

<a:news-article xmlns:c="http://sometext.com/ns/core"; 
xmlns:f="http://sometext.com/ns/fields"; xmlns:a="http://sometext.com/ns/assets”>
  <c:id>id1</c:id>
  <f:body>
    <p>
      Henkel has increased its stake in Russian detergents producer
      Era, based in Tosno near St Petersburg to almost 80% through
      the acquisition of an additional 3.1% of the company's shares
      for $240 000. A Henkel-financed $21m capital spending
      programme, aimed at modernising production facilities at Era,
      is proceeding according to plan and is to be completed by Q3
      1997.co<sub>2</sub>
    </p>
  </f:body>
</a:news-article>

The Query Generated By Marklogic is as follows  pattern highlighted in yellow:


<cts:and-query xmlns:cts="http://marklogic.com/cts";>
     <cts:not-query>
       <cts:element-range-query operator="&gt;">
               <cts:element 
xmlns:c="http://sometext.com/ns/core";>c:released-on</cts:element>
               <cts:value xsi:type="xs:dateTime" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>2015-10-19T09:47:00Z</cts:value>
       </cts:element-range-query>
     </cts:not-query>
     <cts:or-query>
       <cts:collection-query>
               <cts:uri>urn:iddn:collections:kind/news-article</cts:uri>
       </cts:collection-query>
     </cts:or-query>
     <cts:element-query>
       <cts:element xmlns:f="http://sometext.com/ns/fields";>f:body</cts:element>
       <cts:word-query>
               <cts:text xml:lang="en">co2</cts:text>
               <cts:option>case-insensitive</cts:option>
               <cts:option>diacritic-sensitive</cts:option>
               <cts:option>punctuation-insensitive</cts:option>
               <cts:option>whitespace-sensitive</cts:option>
               <cts:option>unstemmed</cts:option>
               <cts:option>unwildcarded</cts:option>
       </cts:word-query>
     </cts:element-query>
     <cts:or-query>
       <cts:element-range-query operator="&gt;=">
               <cts:element 
xmlns:c="http://sometext.com/ns/core";>c:expires-on</cts:element>
               <cts:value xsi:type="xs:dateTime" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>2015-10-19T09:47:17.571Z</cts:value>
       </cts:element-range-query>
       <cts:not-query>
               <cts:element-value-query>
                 <cts:element 
xmlns:c="http://sometext.com/ns/core";>c:expires-on</cts:element>
                 <cts:text xml:lang="en">*</cts:text>
                 <cts:option>wildcarded</cts:option>
               </cts:element-value-query>
       </cts:not-query>
     </cts:or-query>
   </cts:and-query>


But I did not get any record with this cts query.

cts:search(fn:doc(),
            cts:query($cts-query), "unfiltered")


if I change the pattern with co 2 . ie insert a space in between the sub tag 
the query works fine.

Any help is appreciated how should I search this document without providing 
space for sub tag text.

Thanks
Ashutosh Trivedi





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

Reply via email to