[MarkLogic Dev General] Quality weight
Danny Sokolsky
Danny.Sokolsky at marklogic.com
Mon Oct 18 13:51:47 PDT 2010
Hi Stewart,
Maybe I am not understanding what you are asking, but I think <quality-weight> will do what you want using the search API. It should behave the same way as passing a quality-weight to cts:search (and in fact, I think that is what the search API is doing with it).
Here is the tricky thing about quality: the quality on a document is 0 by default, so unless you create a document with some quality or update with some quality, any quality-weight you add to a search will have no effect.
As an example, I created a single document in an empty db with a quality of 100:
xdmp:document-insert("/test.xml", <a>hello</a>, (), (), 100)
Next I ran search:search on it with no options:
search:search("hello")
the score was 204
Next, I ran search:search with a quality-weight of 1.0 (the default):
xquery version "1.0-ml";
import module namespace search =
"http://marklogic.com/appservices/search"
at "/MarkLogic/appservices/search/search.xqy";
let $options :=
<options xmlns="http://marklogic.com/appservices/search">
<quality-weight>1.0</quality-weight>
</options>
return
search:search("hello", $options)
The score is still 204.
Now change the options node as follows:
<quality-weight>2.0</quality-weight>
The score is now 304.
If you make it 3.0, it will be 404 [ 104 + (3.0 * 100) ].
Does that make sense?
-Danny
-----Original Message-----
From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Stewart Shelline
Sent: Monday, October 18, 2010 12:51 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Quality weight
According to the Search Developer's Guide, a document's score is calculated as follows when using cts:search:
Score = Score + (QualityWeight * Quality)
How can I get this same effect when using search:search? It appears the <quality-weight> parameter is not the right answer, since it applies the weight to the overall score for the document, not as a qualifier on the document's document quality, i.e.:
Score = (Score + Quality) * QualityWeight
NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
_______________________________________________
General mailing list
General at developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
More information about the General
mailing list