>From the doc for cts:or-query, 'synonym' means:

Specifies that all of the terms in the $queries parameter are considered
synonyms for scoring purposes. The result is that occurrences of more than
one of the synonyms are scored as if there are more occurrences of the same
term (as opposed to having a separate term that contributes to score).

So it sounds like the scoring would be similar to 1 hit for a query in docs
1,3 and 2 hits for the same query in doc2, and you'd expect doc2 to score
higher in that situation.

Similar description for 'synonym' in cts:element-word-query seems to
bolster this interpretation (to me).

/ch

On Thu, Aug 17, 2017 at 9:55 AM, Andreas Hubmer <[email protected]>
wrote:

> 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
>
>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to