I have a fact fragment created in the database every time an article is
viewed, for example:
<fact>
<doc-id>12345</doc-id>
<type>read</type>
<user>userIdHere</user>
<date>dateTimeHere</date>
</fact>
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.
Example:
cts:values(
cts:element-reference(xs:QName('doc-id'), ("type=string","collation=
http://marklogic.com/collation/")),
(),
(
"limit=6",
"descending",
"score-logtfidf"
),
cts:and-query((
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.
Thanks,
-Will
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general