Thank for your article, I’ve realized a big difference in fundamental between Tamino XQuery and relational SQL (where I came from).
Actually, my XQuery was like this:
let $b:=count(for $a in input()/doc return $a/element1)
‘element1’ has both standard and text index defined.
I was assuming by returning ‘$a/element1’, this would enhance the optimizer since it would work similar to a ‘covering’ index in SQL, where the data is already covered or made available by the index, it doesn’t cost any extra to retrieve it.
Little did I know, index in Tamino only provides access to the documents, not for retrieving data. I guess there are no such thing as covering index due to the nature of hierchical data.
Now the XQuery count works fine:
let $b:=count(for $a in input()/doc return $a)