Hi Christian, Thanks, that works for me. I always prefer less complex code :-) so it would be nice if this feature made a return at some point.
Regards /Andy On Fri, Apr 11, 2014 at 12:04 PM, Christian Grün <christian.gr...@gmail.com>wrote: > Hi Andy, > > as we haven't managed so far to formalize scoring propagation for all > XQuery expressions, and as we thought that XQuery itself can also be > used to combine score values, we have recently decided to reduce our > scoring to the most essential operation (namely, "contains text"). > > One solution to get this working again is: > > let $data:= ( > <r><a>red apple</a></r>, > <r><a>blue lagoon</a></r>, > <r><b>fish and chips</b></r> > ) > for $hit in $data > let score $a := $hit/a contains text "red" > let score $b := $hit/b contains text "fish" > let $score := ($a + $b) div 2 > where $score > return $hit > > The advantage is that you can decide by yourself how you want to > combine scores. The drawback, obviously, is that your code gets more > complex. > > Best, > Christian > > > > On Thu, Apr 10, 2014 at 6:27 PM, Andy Bunce <bunce.a...@gmail.com> wrote: > > Hi, > > > > I want to score searches with multiple conditions e.g. > > > > let $data:=( > > <r><a>red apple</a></r>, > > <r><a>blue lagoon</a></r>, > > <r><b>fish and chips</b></r>) > > > > for $hit score $s in $data[ > > a contains text("red") > > or b contains text("fish")] > > > > return $s > > > > In 7.8.2 it always returns scores of zero. > > In version 7.6 it returns numbers like 0.6201145069582775 > 0.4528324252639413 > > > > Is this bug? > > Regards > > /Andy >