0

Use version:4.5.0

db/system/config/db/test/collection.xconf The code is as follows:

<range>
        <create qname="item">
            <condition attribute="name" value="number"/>
            <field name="number" match="@value" type="xs:decimal"/>
        </create>
        <create qname="item">
            <condition attribute="name" value="acreage"/>
            <field name="acreage" match="@value" type="xs:decimal"/>
        </create>
        <create qname="item">
            <condition attribute="name" value="radii"/>
            <field name="radii" match="@value" type="xs:decimal"/>
        </create>
        <create qname="item">
            <condition attribute="name" value="diameter"/>
            <field name="diameter" match="@value" type="xs:decimal"/>
        </create>
    </range>

Browse Indexes

db/test The code of an XML file is as follows:

<root>
<item name="number" value="4"/>
<item name="acreage" value="5"/>
<item name="radii" value="6"/>
<item name="diameter" value="7"/> </root>

Query statement:

//item[@name='radii'][@value>5.0]

Query Profiling

No result

In theory, the XML file can be found, but the result can not be found for what? Can you help me? Thank you!

B.hl
  • 15
  • 3

1 Answers1

1

Based on the documentation for eXist's Conditional Combined Indexes feature you are trying to use here, it appears to me that this feature only support string comparisons (with an optional "numeric" mode). See https://exist-db.org/exist/apps/doc/newrangeindex#D3.21.18. In other words, your @type="xs:decimal" is not resulting in your attributes' values being cast to xs:decimal; effectively, instead, they are being indexed as xs:string.

Thus, for your query to work with the given data, change the predicate to [@value gt "5"].

Or, to force numeric comparisons, add numeric="yes" to the <field> element in your index definitions, and then change your predicate to [@value gt "5.0"].

Joe Wicentowski
  • 5,159
  • 16
  • 26