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 2012/06/15 03:43:13 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 "SolrRelevancyFAQ" page has been changed by HossMan:
http://wiki.apache.org/solr/SolrRelevancyFAQ?action=diff&rev1=24&rev2=25

Comment:
elaborate on boosting documents, mention ExternalFileField

  {{{q="batman movie"&qs=100}}}
  
  == How can I increase the score for specific documents ==
+ 
+ === Query Elevation Component ===
+ To raise certain documents to the top of the result list based on a certain query, one can use the QueryElevationComponent.
+ 
  === index-time boosts ===
  To increase the scores for certain documents that match a query, regardless of what that query may be, one can use index-time boosts.
  
@@ -89, +93 @@

  
  Be aware that all index-time boosts end up being encoded into a single byte using [[http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/api/core/org/apache/lucene/search/Similarity.html#encodeNormValue%28float%29|Similarity.encodeNormValue]], which uses a 3-bit mantissa. So differences in boost values of less than 25% may end up being rounded out.
  
- === Query Elevation Component ===
- To raise certain documents to the top of the result list based on a certain query, one can use the QueryElevationComponent.
+ === Field Based Boosting ===
+ 
+ You can structure your queries to include "boosts" based on specific attributes of documents.  This might be a simple matter of adding an optional query clause that "boosts" documents for matching an "important:true" query, or by using a function on the value of a numeric field (see the next section)
  
  == How can I change the score of a document based on the *value* of a field (say, "popularity") ==
  Use a FunctionQuery as part of your query.
@@ -101, +106 @@

  
  {{{
    # simple boosts by popularity
-   q=%2Bsupervillians+_val_:"popularity"
+   defType=lucene&df=text&q=%2Bsupervillians+_val_:"popularity"
    defType=dismax&qf=text&q=supervillians&bf=popularity
+   q={!boost b=popularity}text:supervillians
  
    # boosts based on complex functions of the popularity field
-   q=%2Bsupervillians+_val_:"scale(popularity,0,100)"
+   defType=lucene&q=%2Bsupervillians+_val_:"sqrt(popularity)"
    defType=dismax&qf=text&q=supervillians&bf=sqrt(popularity)
+   q={!boost b=sqrt(popularity)}text:supervillians
  }}}
+ 
+ These functions can also operate on an [[http://lucene.apache.org/solr/api/org/apache/solr/schema/ExternalFileField.html|ExternalFileField]]
+ 
  == How are documents scored ==
  Basic scoring factors: