title: My xpath query fails to use the range index. What am I doing wrong?
body: <p>I'm finding a related element through it's id, stored in a reference element's href, like so:</p>
  
  <pre><code>let $item := ($doc//(map|question|theory|reading|glossgroup))[@id = $ref/@href]
  </code></pre>
  
  <p>Reading ExistDB's documentation, I'm pretty sure a simple <code>&lt;create qname="@ID" type="xs:string" /&gt;</code> index should've been enough, and should perhaps even be autogenerated.. but looking at the profiler, my query is not using any indexes.</p>
  
  <p>I've even tried</p>
  
  <pre><code>let $item := $doc//map[@id = $ref/@href]
  </code></pre>
  
  <p>And created an index with the id field like so</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;index&gt;
      &lt;range&gt;
          &lt;create qname="map" type="xs:string"&gt;
              &lt;field name="map-id" match="@id" type="xs:string" /&gt;
          &lt;/create&gt;
      &lt;/range&gt;
  &lt;/index&gt;
  </code></pre>
  
  <p>But nothing seems to be working.</p>
  
  <p>I'm pretty new to ExistDB.. probably doing something obvious wrong, so if anybody can point me in the right direction :)? </p>
  
  <p>Example XML:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;root&gt;
    &lt;map id="ide931fee3-6a45-4435-a8d2-f018ae2ca2ea"&gt;
      &lt;mapref href="f80cc8c8-6b6d-4005-b2e9-85eac2ee2fbf.1.36" /&gt;
    &lt;/map&gt;
    &lt;map id="f80cc8c8-6b6d-4005-b2e9-85eac2ee2fbf.1.36"&gt;
      &lt;topicref href="47aed1dd-62f7-4fb6-ae76-dbfcde0a4bab.1.9" /&gt;
    &lt;/map&gt;
    &lt;question id="47aed1dd-62f7-4fb6-ae76-dbfcde0a4bab.1.9"&gt;
      ...
    &lt;/question&gt;
  &lt;/root&gt;
  </code></pre>