I create a DB with one XML document using TF/IDF text node strategy and when make query on it always obtain the same score for all results equal one.
declare option output:omit-xml-declaration "no";
declare variable $w1 as xs:string external := 'roma';
declare variable $w2 as xs:string external := '';
<results>
{
for $hit score $score in /kdo/idf/idf/idf/idf/idf[text() contains text {$w1} all words using wildcards ]
let $cap := $hit/idf[@ctx="20.1"]/text()
let $continente := $hit/ancestor-or-self::idf[@ctx="20.9"]/text()
order by $score descending
return
<result score="{$score}">
<continente>{$continente}</continente>
<paese>{$hit/../../../text()}</paese>
<regione>{$hit/../../text()}</regione>
<provincia>{$hit/../text()}</provincia>
<cap>{$cap}</cap>
<nome>{$hit/text()}</nome>
</result>
}
</results>
executed through RESTFULL with the URL
and follow the query results:
<?xml version="1.0" encoding="UTF-8"?>
<results count="6"> <result score="1"> <continente>EUROPA</continente> <paese>ITALIA</paese> <regione>LAZIO</regione> <provincia>FROSINONE</provincia> <cap>03020</cap> <nome>GIULIANO DI ROMA</nome> </result> <result score="1"> <continente>EUROPA</continente> <paese>ITALIA</paese> <regione>LAZIO</regione> <provincia>VITERBO</provincia> <cap>01034</cap> <nome>FABRICA DI ROMA</nome> </result> <result score="1"> <continente>EUROPA</continente> <paese>ITALIA</paese> <regione>LAZIO</regione> <provincia>ROMA</provincia> <cap>00063</cap> <nome>CAMPAGNANO DI ROMA</nome> </result> <result score="1"> <continente>EUROPA</continente> <paese>ITALIA</paese> <regione>LAZIO</regione> <provincia>ROMA</provincia> <cap>00020</cap> <nome>CERVARA DI ROMA</nome> </result> <result score="1"> <continente>EUROPA</continente> <paese>ITALIA</paese> <regione>LAZIO</regione> <provincia>ROMA</provincia> <cap>00045</cap> <nome>GENZANO DI ROMA</nome> </result> <result score="1"> <continente>EUROPA</continente> <paese>ITALIA</paese> <regione>LAZIO</regione> <provincia>ROMA</provincia> <cap>001xx</cap> <nome>ROMA</nome> </result> </results>
for each result node you can see the score node with the same value for deferents <nome> nodes strings.
Sorry for my English, and thanks for any comment.