[MarkLogic Dev General] cts:values scoring
Danny.Sokolsky at marklogic.com
Wed Jan 6 15:52:11 PST 2016
The scores are used for the truncate=N and other options that use a cts:query. In those cases, the score will be used to find the top n fragments to limit|skip|sample|truncate.
If you want relevance order, I believe you have to do a cts:search.
From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of William Sawyer
Sent: Wednesday, January 06, 2016 3:29 PM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] cts:values scoring
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-range-query(xs:QName('date'), "<=", fn:current-dateTime(), ("score-function=reciprocal", "slope-factor=2"), 16),
cts:element-range-query(xs:QName('user'), "=", "currentUser", "collation=http://marklogic.com/collation/"),
cts:element-range-query(xs:QName('type'), '=', "read", "collation=http://marklogic.com/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...
More information about the General