Jakob,

Do you really want 'query' in *any* namespace? It looks to me like 'query' is in the empty namespace, and is always a child of the root 'result', so I would write '/result/query' or '//query' instead of '//*:query'. If you need to find 'query' in multiple namespaces, I recommend enumerating all the possibilities.

Expressions using '*:' are best avoided in production code. They tend to introduce bugs into your application, and they can't be resolved using the server's indexes. While '*:' expressions can be useful when debugging, they should be removed as soon as possible. When doing code reviews, I treat them as a red flag.

thanks,
-- Mike

On 2009-07-16 04:38, Jakob Fix wrote:
Here I am again ...

1) added a number of test items to the collection "test"
2) each document contains xml like this

<result>
   ....
   <query key="555-555" status="resolved" fl_count="0">
     <doi type="journal_title">10.1787/1684341x</doi>
     <issn type="print">16095316</issn>
     <journal_title>Documents de l OCDE</journal_title>
   </query>
</result>

3) I am interested in all documents in the "test" collection where the
xpath //*:que...@status="resolved"] on the one side, and
[...@status="unresolved"] on the other side - using the xpath directly
works, but is too slow over many thousand documents.

4) I've created an attribute range index for xs:string, "query",
"status" (no namespaces defined; btw, I also created an
element-attribute word index, but it seems that this is not necessary)

5) I was hoping the following query would return the expected results,
but it doesn't:

cts:search(fn:doc(),
    cts:and-query((
      cts:collection-query(("test")),
      cts:element-attribute-word-match(xs:QName("query"),
xs:QName("status"), "unresolved")
    ))
)
return xdmp:node-uri($x)

6) three of the four test documents have a @status="resolved" and one
"unresolved" so I expected one uri for the above query.  However, the
result is this:
/data/2009/07/16/1684341X.xml
/data/2009/07/16/16097513.xml
/data/2009/07/16/16812328.xml
/data/2009/07/16/16097408.xml

I do get an empty sequence when asking for @status="resolved" ...  Is
this just a configuration problem, or is my query wrongly constructed?

Thanks, as usual, for your help,
Jakob.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to