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 YonikSeeley. The comment on this change is: add reference to QuertyElevation , move function next to index-boosting since it's related. http://wiki.apache.org/solr/SolrRelevancyFAQ?action=diff&rev1=14&rev2=15 -------------------------------------------------- == How can I increase the score for specific documents == + === 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. Index-time boosts can be specified per-field also, so only queries matching on that specific field will get the extra boost. An Index-time boost on a value of a multiValued field applies to all values for that field. - Index-time boosts are assigned with the optional attribute "boost" in the <doc> section of the XML updating messages. See UpdateXmlMessages for more informations. + Index-time boosts are assigned with the optional attribute "boost" in the <doc> section of the XML updating messages. See UpdateXmlMessages for more information. + === Query Elevation Component === + To raise certain documents to the top of the result list based on a certain queries, one can use the QueryElevationComponent. + + == 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. + + 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]]. + + 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 are documents scored == Basic scoring factors: @@ -161, +180 @@ 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 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]]. - - 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)
