[MarkLogic Dev General] cts:values scoring

William Sawyer wilby.sawyer at gmail.com
Wed Jan 6 15:28:31 PST 2016

I have a fact fragment created in the database every time an article is
viewed,  for example:


I am wanting to display a distinct list of the most recent viewed
documents.  I found the documentation for cts:values has options for
scoring so I got really excited about using cts:values with a date range
query with linear slope scoring to produce both a distinct list ordered by
most recent.

cts:element-reference(xs:QName('doc-id'), ("type=string","collation=
cts:element-range-query(xs:QName('date'), "<=", fn:current-dateTime(),
("score-function=reciprocal", "slope-factor=2"), 16),
cts:element-range-query(xs:QName('user'), "=", "currentUser", "collation=
cts:element-range-query(xs:QName('type'), '=', "read", "collation=

The problem is cts:values always returns the values in item order or
frequency order. There is no option to use score order, which makes me ask
the question why can you specify how it scores?  I know there are other
ways to get my desired result.  But it would be a really nice feature to
allow cts:values to return in score order.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20160106/1ef16512/attachment.html 

More information about the General mailing list