You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2009/07/02 20:14:16 UTC

[Solr Wiki] Update of "SolrRelevancyFAQ" by HossMan

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The following page has been changed by HossMan:
http://wiki.apache.org/solr/SolrRelevancyFAQ

------------------------------------------------------------------------------
  Now you should be able to examine the scoring explain info of the top matching documents, compare it to the explain info for documents matching id:juggernaut, and determine why the rankings are not as you expect.
  
  == How can I change the score of a document based on the *value* of a field (say, "popularity") ==
- Use a [http://lucene.apache.org/solr/api/org/apache/solr/search/function/FunctionQuery.html FunctionQuery] as a component of your query.
+ Use a FunctionQuery as a component of your query.
  
  Solr can parse function queries in the following [http://lucene.apache.org/solr/api/org/apache/solr/search/QueryParsing.html#parseFunction(java.lang.String,%20org.apache.solr.schema.IndexSchema) syntax].
  
- TODO: actual examples...
+ Some examples...
+ {{{
+   # simple boosts by popularity
+   q=%2Bsupervillians+_val_:"popularity"
+   defType=dismax&qf=text&q=supervillians&bf=popularity
+ 
+   # boosts based on complex functions of the popularity field
+   q=%2Bsupervillians+_val_:"scale(popularity,0,100)"
+   defType=dismax&qf=text&q=supervillians&bf=sqrt(popularity)
+ }}}
+ 
  
  == How can I boost the score of newer documents ==
    * Do an explicit sort by date (relevancy scores are ignored)

Re: [Solr Wiki] Update of "SolrRelevancyFAQ" by HossMan

Posted by Yonik Seeley <yo...@lucidimagination.com>.
> +   q=%2Bsupervillians+_val_:"scale(popularity,0,100)"

Darn... another SOLR-1111 related issue.  scale() will now only scale
per-segment.

-Yonik
http://www.lucidimagination.com