Hi,

We've discovered the "synonym" option of the cts:or-query and thought that
it would solve an issue we've had for a longer time in several applications
with several clients. But it does not work as expected. Either I am
misunderstanding the effect of the "synonym" option or there is a bug.

The following XQuery snippet demonstrates the issue. Three documents are
inserted into the database. All contain the word "tom", but in different
elements.
In the search an or-query over the different elements is used. Our
expectation was that by using the "synonym" option all results would have
the same score. But the document with both elements name1 and name2 is
scored higher than the other two (about 30% higher).
Why do they have different scores?
I would expect that the "synonym" option is working like a *maximum*
function on the score of the subqueries.

xquery version "1.0-ml";
xdmp:document-insert("/1.xml",
  <root>
    <name1>tom</name1>
  </root>
)
,
xdmp:document-insert("/2.xml",
  <root>
    <name1>tom</name1>
    <name2>tom</name2>
  </root>
),
xdmp:document-insert("/3.xml",
  <root>
    <name2>tom</name2>
  </root>
)
;

xquery version "1.0-ml";
cts:search(/,
  cts:or-query((
      cts:element-word-query(xs:QName("name1"), "tom"),
      cts:element-word-query(xs:QName("name2"), "tom")
    ), "*synonym*"),
  "score-simple"
)
!
("Score: " || cts:score(.), .)

"Fast element word searches" are turned on in the database.
The scoring model (score-simple or score-logtf) does not make a difference.

It would be great if you could help me!

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

Reply via email to