Hi Danny, what does a weight of 16 do effectively? I've experimented with 
boosting scores in field and word-query configurations, and it never seemed to 
affect the score enough to make any actual difference to relevance-ranked 
results. If I remember correctly, 16 was insufficient--I would have needed 100 
or 200 or more to move the rankings on title matches for example. I would love 
to learn more. Thanks.

On Oct 6, 2010, at 2:28 PM, Danny Sokolsky wrote:

> You can put weights on the cts:query constructors to affect how much a match 
> in each constructor contributes to score.  You can also change the word query 
> configuration on the database to boost the weight for a particular element 
> (like title, for example).  The word query configuration change bakes that 
> weight into the index.
> 
> To accomplish the cts:query weight boost, you might create a query that 
> combines word-query and element-word-query with an and-query of a word-query 
> and an or-query (so you keep the semantics the same as just the word-query), 
> with a weight on the element-word-query.  Something like:
> 
> cts:and-query((
>  cts:word-query($q),
>  cts:or-query((
>     cts:element-word-query(xs:QName("title"), $q, (), 16) ))
>  ))
> 
> This would boost the score of matches that occur in title elements. 
> 
> For more details about relevance, see "Relevance Scores: Understanding and 
> Customizing" chapter in the Search Developer's Guide.
> 
> -Danny
> 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Shah, Mehul 
> (LNG-NPV)
> Sent: Wednesday, October 06, 2010 9:24 AM
> To: General Mark Logic Developer Discussion
> Subject: [MarkLogic Dev General] relevance by element/attribute values
> 
> For a given query, is there a way to indicate field1 (title) has higher 
> weight compared to other fields (body-text) for search relevance.
> i.e.  
> Query: "New York"
> Doc1- has "New York" in <bodytext> 3 times 
> Doc2- has "New York" in <title> once
> (where <bodytext> or <title> may have more elements within it.)
> 
> How do I do search:search to get result in such order that Doc-2 appears 
> first (even though it has less hits for the query terms).
> 
> 
> Thanks.
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to