Perhaps you can add another query to your "or" query list looking for
the attribute value and boosting the score. I think this will work as
long as you know the element in which the type attribute exists. For
example:
cts:or-query((
cts:word-query("baseball", (), 1),
cts:element-word-query(
(xs:QName("title"), xs:QName("head")), "baseball", (), 16
),
cts:element-attribute-value-query(xs:QName("myElement"),
xs:QName("type"),
"baseball", (), 16 )
))
If you have some content that does not match your other queries but does
match the e-a-v-query, then you would have to make some more complicated
boolean logic for this to work, but that is probably doable.
-Danny
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mattio
Valentino
Sent: Thursday, April 10, 2008 1:00 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Boosting scores based on an attribute
I'm not sure if I'm going to express this correctly but I hope it's
clear.
I have a query that searches for a term. If the term occurs in a
title or head element, the score is boosted.
cts:or-query((
cts:word-query("baseball", (), 1),
cts:element-word-query(
(xs:QName("title"), xs:QName("head")), "baseball", (), 16
)
))
If I have two documents where one has an attribute type="biography",
can I form the query to return *both* documents but boost the score up
further on the "biography" one?
This has been stewing for a few days now and I've been trying
different versions in cq, but I can't see how to put the cts:query
constructors together to do it.
Thanks for any help,
Matt
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general