Hi, As mentioned in my previous mail, we are running MarkLogic 8.0-3 and using the "additional query" technique to influence the ordering of search results (as discussed here http://markmail.org/message/cmxhjxd77clicsbz). We have found something else that is not working as we would expect with range queries, this time it is slope factor with date values. The documentation here: https://docs.marklogic.com/guide/search-dev/relevance#id_32386 suggests that with the default slope factor of 1.0 the granularity of date values should be roughly 1.5 days. We understand that to mean that with dates which are 2 or more days apart, they should fall into different buckets and so contribute different amounts to the search score. But we are not seeing that.
As as an example, given an empty database with an element range index set up on the element "birth" as follows: import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; let $dbid := xdmp:database("Documents") let $config := admin:get-configuration() let $rangespec := admin:database-range-element-index("date", "", "birth", "", fn:false() ) let $new-config := admin:database-add-range-element-index($config, $dbid, $rangespec) return admin:save-configuration($new-config) Then with the following documents inserted: let $step := 3 let $start := xs:date("2000-01-01") let $_ := xdmp:document-insert("/deb", <person><role>Bloo</role><birth>{$start + 3 * $step * xs:dayTimeDuration('P1D')}</birth></person>) let $_ := xdmp:document-insert("/eve", <person><role>Bloo</role><birth>{$start + 2 * $step * xs:dayTimeDuration('P1D')}</birth></person>) let $_ := xdmp:document-insert("/flo", <person><role>Bloo</role><birth>{$start + 1 * $step * xs:dayTimeDuration('P1D')}</birth></person>) return () The following query returns all 3 documents with the same score: import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy"; let $or-query := cts:or-query(( cts:and-query(()), cts:element-range-query(xs:QName("birth"), ">", xs:date("2000-01-01"), ("score-function=linear", "slope-factor=1.0")) )) let $options := <options xmlns="http://marklogic.com/appservices/search"> <additional-query>{$or-query}</additional-query> </options> let $search := search:search("Bloo", $options) return for $result in $search//search:result return $result/@uri || ": " || $result/@score In fact, the step needs to be increased to 4 days in order for one of them to have a different score and to 8 for them to get distinct scores. Once again, if anyone can explain why this is not working as we expect it would be very helpful, Thanks Chris Rimmer 67 Bricks
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
