Oke Christian, I learned a lot from you. Have a nice weekend. Regards, Wiard 2011/5/20 Christian Grün <christian.gruen@gmail.com>
XQuery is a functional language; as such, you can never update variables that have already been assigned. The count() function gives you the number of items in a sequence:
<hit score='{ $s }'>{ $n, count($n) }</hit> ___________________________
On Fri, May 20, 2011 at 5:05 PM, Wiard Vasen <wiard.vasen@gmail.com> wrote:
Hi Christian, I would like to make a counter for the number of documents containing the terms from the query. I made one in blue in the following query. let $range := 1 to 800 for $doc in collection('brievenvangogh') let $uri := base-uri($doc), $num := substring($uri, string-length($uri) - 6, 3) where $num castable as xs:integer and xs:integer($num) = $range return <document uri='{$uri}'>{ let $t := 0 for $n score $s in $doc//*[text() contains text {'gauguin','pissarro'}all ] return $t:=+1; return <hit score='{$s}'>{$n}{$t} }</hit> } </document> Could you help me make this counter work? Thank you in advance. Regards, Wiard 2011/5/20 Wiard Vasen <wiard.vasen@gmail.com>
Hi Christian, The query works. Thanks a lot! Regards, Wiard
2011/5/20 Wiard Vasen <wiard.vasen@gmail.com>
You are probably right. That would be funny. I am going to figure it out. Regards.
2011/5/20 Christian Grün <christian.gruen@gmail.com>
$doc//*[text() contains text {'gauguin','pissarro','monet'}all ]
I would assume that none of the text nodes in your document contains all three names.