Hi,

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). While this is mostly
working, we have found that when the "boosting queries" are specified with
weights less than 0.5, they have no influence on the score at all. The
relevant documentation (
https://docs.marklogic.com/guide/search-dev/relevance#id_22791) says "To
lower the score contribution, set the weight between 0 and 1.0". There is
no suggestion that any value less than 0.5 is effectively zero.

As as an example, given an empty database with an element range index set
up on the element "name" 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("string", "",
"name", "http://marklogic.com/collation/";, fn:false() )
  let $new-config := admin:database-add-range-element-index($config, $dbid,
$rangespec)
  return admin:save-configuration($new-config)

Running the following with the weight set to 0.5 will show that the "Bob"
document is indeed scored higher than the others, while when this is set to
0.49, all the documents come out with the same weight:

  import module namespace search = "http://marklogic.com/appservices/search";
at "/MarkLogic/appservices/search/search.xqy";

  let $weight := 0.5

  let $_ := xdmp:document-insert("/alf",
<person><name>Alf</name><role>Blah</role></person>)
  let $_ := xdmp:document-insert("/bob",
<person><name>Bob</name><role>Blah</role></person>)
  let $_ := xdmp:document-insert("/cal",
<person><name>Cal</name><role>Blah</role></person>)

  let $or-query := cts:or-query((
        cts:and-query(()),
        cts:element-range-query(xs:QName("name"), "=", "Bob",
("score-function=linear"), $weight)
  ))

  let $options := <options xmlns="http://marklogic.com/appservices/search";>
    <additional-query>{$or-query}</additional-query>
  </options>

  let $search := search:search("Blah", $options)

  return for $result in $search//search:result
    return $result/@uri || ": " || $result/@score

Any ideas about what is happening would be appreciated,

Thanks

Chris Rimmer

67 Bricks
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to