Search code examples
xmlmarklogicmarklogic-8

xml:lang breaking my queries when added to document


I have a document similar to the following:

<?xml version="1.0" encoding="UTF-8"?>
<content-group status="preview" doctype="contentGroup" locale="deu" xml:lang="deu">      
  <associated-doctype its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">article</associated-doctype>
  <is-top-level its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">true</is-top-level>      
  <name>Some Name</name>
  <metadata its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">
    <topic type="app">
      <id/>
      <name/>
    </topic>
  </metadata>
  <id>10788827132666922020-deu</id>
</content-group>

I have been using the following query to find it:

<query xmlns="http://marklogic.com/appservices/search" xmlns:search="http://marklogic.com/appservices/search" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <and-query>
            <value-query type="string">
                <element ns="" name="content-group"/>
                <attribute ns="" name="doctype"/>
                <text>contentGroup</text>
            </value-query>
            <value-query type="string">
                <element ns="" name="is-top-level"/>
                <text>true</text>
            </value-query>
            <value-query type="string">
                <element ns="" name="associated-doctype"/>
                <text>article</text>
            </value-query>
            <value-query type="string">
                <element ns="" name="content-group"/>
                <attribute ns="" name="locale"/>
                <text>deu</text>
            </value-query>
        </and-query>
        </query>

I only recently added the xml:lang attribute to the root element. Previous to adding it, the query above worked fine, but once I added the lang element, my query will no longer return documents as expected. What is my query missing?


Solution

  • Add <term-option>lang=deu</term-option> after the text elements.