Hello,

I have a question about query and attribute range query
I have a customer xml file stored in database and an attribute range 
index on Customer id, if my query is like:

for $cust in doc()
where $cust/Customer/@id = 1002
return $cust

The range index is not used and the trace file is here:

Info: benchHttp: line 7: xdmp:eval("xquery version 
&quot;1.0-ml&quot;;&#13;&#10;(: buffer 2 :)&#13;&...", (), <options 
xmlns="xdmp:eval"><root>benchHttp</root><isolation>different-transaction</isolatio...</options>)
Info: benchHttp: line 7: Analyzing path for $cust: fn:doc()
Info: benchHttp: line 7: Step 1 is searchable: fn:doc()
Info: benchHttp: line 7: Path is fully searchable.
Info: benchHttp: line 7: Gathering constraints.
Info: benchHttp: line 7: Step 1 contributed 1 constraint: fn:doc()
Info: benchHttp: line 8: Comparison contributed hash value constraint: 
Customer/@id = 1002
Info: benchHttp: line 7: Where clause contributed 2 constraints for 
$cust: $cust/Customer/@id = 1002
Info: benchHttp: line 7: Executing search.
Info: benchHttp: line 7: Selected 1 fragment to filter

If I wrote query like this:

cts:search(doc()/Customer,
cts:element-attribute-range-query(xs:QName("Customer"), xs:QName("id"), 
"=" ,1002))

xdmp:query-trace(true()),(
cts:search(doc()/Customer,
cts:element-attribute-range-query(xs:QName("Customer"), xs:QName("id"), 
"=" ,1002))
)

The index is used but no results returned. Here is the trace file:

line 7: xdmp:eval("xquery version &quot;1.0-ml&quot;;&#13;&#10;(: buffer 
2 :)&#13;&...", (), <options 
xmlns="xdmp:eval"><root>benchHttp</root><isolation>different-transaction</isolatio...</options>)
line 7: Analyzing path for search: fn:doc()/Customer
line 7: Step 1 is searchable: fn:doc()
line 7: Step 2 is searchable: Customer
line 7: Path is fully searchable.
line 7: Gathering constraints.
line 7: Step 2 test contributed 1 constraint: Customer
line 7: Comparison contributed int range value constraint: Customer/@id 
= 1002
line 7: Search query contributed 1 constraint: 
cts:element-attribute-range-query(fn:QName("http://tpox-benchmark.com/custacc";, 
"Customer"), fn:QName("http://tpox-benchmark.com/custacc";, "id"), "=", 
1002, (), 1)
line 7: Executing search.
line 7: Selected 0 fragments to filter

Could you show me the reason? Thank you very much!

Regards,
Ling
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to