fulltext score value
Hello community, I have a question about score results.
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.
the query is:
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
http://localhost:8984/basex/jax-rx/comuni?wrap=no&run=fulltext_wildcards.xq&var=w1=roma
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.
Dear Pablo,
final score values may be influenced by many side effects (use of index, document structure, etc.). To give you more info, we'd need to have a look on the original XML documents, or a little sample that allows us to reproduce the resulting score values. It would be great if you could provide us with a small example that runs out of the box.
Hope this helps, Christian
Quoted text · Juan Pablo · 65 lines
On Mon, Jan 24, 2011 at 5:17 PM, KUSTER, Juan Pablo <pablokuster at gmail.com> wrote: > Hello community, I have a question about score results. > 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. > the query is: > 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 > http://localhost:8984/basex/jax-rx/comuni?wrap=no&run=fulltext_wildcards.xq&var=w1=roma > 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. > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
Written for BaseX 6. BaseX may have changed since: please check the current documentation.