Changes

Jump to navigation Jump to search
517 bytes added ,  23:44, 23 November 2014
This simple approach has proven to consistently deliver good results, and in particular when little is known about the structure of the queried XML documents.
As Please note that scores will only be implicitly bound to the boolean item of computed if a full-text parent expression, they can also be made visible later by binding full-text results to a score variablerequests them:
<pre class="brush:xquery">
let $hits1 (:= //text[Computes and returns a scoring value. contains text "A"]:)let score $hits2 score := <x>Hello Universe<//text[. x> contains text "Bhello"]let score $score := $hits1 and $hits2
return $score
 
(: No scoring value will be computed here. :)
let $result := <x>Hello Universe</x> contains text "hello"
let score $score := $result
return $score
</pre>
 
With {{Version|8.0}}, scores will be propagated by the {{Code|and}} and {{Code|or}} expressions, and by multiple predicates. The following queries will all yield the same result:
 
<pre class="brush:xquery">
let $text := "A B C"
let score $s1 := $text[. contains text "A"][. contains text "B C"]
let score $s2 := $text contains text "A" and $text contains text "B C"
let score $s3 := $text contains text "A" or $text contains text "B C"
return ($s1, $s2, $s3)
</pre>
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu