1
votes

score-function option in cts:element-range-query seems to be not working in marklogic version 9.0-9.1. but it is working in marklogic version 8.

To test check this, inserted few documents in document database using insert query:

xdmp:document-insert("/test1.xml", <rating>1</rating>, (), "temp"),
xdmp:document-insert("/test2.xml", <rating>2</rating>, (), "temp"),
xdmp:document-insert("/test3.xml", <rating>3</rating>, (), "temp"),
xdmp:document-insert("/test4.xml", <rating>4</rating>, (), "temp")

added element range index for element "rating" to document database

cts:search(fn:doc(), cts:element-range-query(fn:QName("","rating"), "<=", xs:int("4"), ("score-function=reciprocal"), 2))

result from ML 9.0-9.1

<?xml version="1.0" encoding="UTF-8"?>
<rating>1</rating>
<?xml version="1.0" encoding="UTF-8"?>
<rating>3</rating>
<?xml version="1.0" encoding="UTF-8"?>
<rating>2</rating>
<?xml version="1.0" encoding="UTF-8"?>
<rating>4</rating>

result from ML 8.0-4.2

<?xml version="1.0" encoding="UTF-8"?>
<rating>4</rating>
<?xml version="1.0" encoding="UTF-8"?>
<rating>3</rating>
<?xml version="1.0" encoding="UTF-8"?>
<rating>2</rating>
<?xml version="1.0" encoding="UTF-8"?>
<rating>1</rating>

Did anyone notice this difference? Is there anything that I am missing here.

Any suggestion would be most appreciated

1

1 Answers

2
votes

This may be a bug. Check what the actual scores there are, I expect that they maybe fall into the same bucket and end up as the same value now. There was a bug in ML8 where the default scaling did not line up with the documented ranges for certain datatypes. You workaround is to use a slope factor of 1/8.