atom feed3 messages in com.marklogic.developer.generalRe: [MarkLogic Dev General] Score-Cal...
FromSent OnAttachments
Andreas HolzgethanAug 28, 2017 10:32 pm 
Andreas HolzgethanSep 3, 2017 11:49 pm 
Chester DavisSep 4, 2017 1:10 am 
Subject:Re: [MarkLogic Dev General] Score-Calculation with cts:element-query
From:Chester Davis (agen@gmail.com)
Date:Sep 4, 2017 1:10:15 am
List:com.marklogic.developer.general

Thanks everyone goodby

On Sep 4, 2017 1:50 AM, "Andreas Holzgethan" <andr@ebcont.com> wrote:

Hi!

Anyone that can explain it to me why the score is different between this two searches? Thanks!

Best regards Andreas Holzgethan

*Andreas Holzgethan BSc. * *IT Consultant * EBCONT enterprise technologies GmbH Millennium Tower Handelskai 94-96 1200 Wien

Mobil: +43 664 606 517 05 Email:andr@ebcont.com Web:http://www.ebcont-et.com/ <http://www.ebcont.com/> <http://www.ebcont.com/> OUR TEAM IS YOUR SUCCESS

HG St. Pölten - FN 293731 h UID: ATU63444589

2017-08-29 7:32 GMT+02:00 Andreas Holzgethan < andr@ebcont.com>:

Hi everyone!

I was analyzing score calculation and found a calculation that looks unclear for me.

For example a cts:or-query without a cts:element-query returns the expected result but putting the cts:or-query into a cts:element-query returns a complete different score, regarding to element-word-query matches (with and without wildcard)

Simple example: Following document is in the database: <test> <element>test</element> </test>

When I execute the following search and get the relevance-info I will get the following result, how I expect: *Search*: cts:search( doc(), cts:or-query(( cts:element-value-query(xs:QName("element"), "test", (), 10), cts:element-word-query(xs:QName("element"), "test", (), 5), cts:element-word-query(xs:QName("element"), "tes**", (), 1) )) , ("score-simple", "relevance-trace") ) ! cts:relevance-info(.)

*Result*: <qry:relevance-info xmlns:qry="http://marklogic.com/cts/query"> <qry:score formula="(256*scoreSum)+(scaleFactor*qualityWeight*documentQ uality)" computation="(256*128)+(256*1*0)"> 32768 </qry:score> <qry:confidence formula="sqrt(score/(256*8*weightSum))" computation=" sqrt(32768/(256*8*16))"> 1 </qry:confidence> <qry:fitness formula="sqrt(score/(256*8*weightSum))" computation=" sqrt(32768/(256*8*16))"> 1 </qry:fitness> <qry:uri> test.xml </qry:uri> <qry:path> fn:doc("test.xml") </qry:path> <qry:or> <qry:score formula="scoreSum" computation="80+40+8"> 128 </qry:score> <qry:term weight="10"> <qry:score formula="8*weight" computation="80"> 80 </qry:score> <qry:key> 15278540559134997888 </qry:key> <qry:annotation> element(element,value("test")) </qry:annotation> </qry:term> <qry:term weight="5"> <qry:score formula="8*weight" computation="40"> 40 </qry:score> <qry:key> 7623328415617434712 </qry:key> <qry:annotation> element(element,word("test")) </qry:annotation> </qry:term> <qry:term> <qry:score formula="8*weight" computation="8"> 8 </qry:score> <qry:key> 8981642353211023247 </qry:key> <qry:annotation> element(element,word("*tes*")) </qry:annotation> </qry:term> </qry:or> </qry:relevance-info>

Now running the same query with an element-query I will get the following result: *Search*: cts:search( doc(), cts:element-query(xs:QName("test"), cts:or-query(( cts:element-value-query(xs:QName("element"), "test", (), 10), cts:element-word-query(xs:QName("element"), "test", (), 5), cts:element-word-query(xs:QName("element"), "tes*", (), 1) )) ) , ("score-simple", "relevance-trace") ) ! cts:relevance-info(.)

*Result*: <qry:relevance-info xmlns:qry="http://marklogic.com/cts/query"> <qry:score formula="(256*scoreSum)+(scaleFactor*qualityWeight*documentQ uality)" computation="(256*136)+(256*1*0)"> 34816 </qry:score> <qry:confidence formula="sqrt(score/(256*8*weightSum))" computation=" sqrt(34816/(256*8*33))"> 0.7177405 </qry:confidence> <qry:fitness formula="sqrt(score/(256*8*weightSum))" computation=" sqrt(34816/(256*8*33))"> 0.7177405 </qry:fitness> <qry:uri> test.xml </qry:uri> <qry:path> fn:doc("test.xml") </qry:path> <qry:or> <qry:score formula="