title: Use function query for boosting score in Solr
body: <p>I working on a Solr 4 for optimizing my solr results rank based on popularity rank stored in Index.</p>
  
  <p>Now when someone searches, apart from relevancy rank, I want to influence relevancy rank using popularity rank. The simplest formula could be:</p>
  
  <blockquote>
    <p>new relavancy rank = score * popularityrank</p>
  </blockquote>
  
  <p>I have been looking at Solr function query at <a href="http://wiki.apache.org/solr/FunctionQuery#product" rel="nofollow noreferrer">http://wiki.apache.org/solr/FunctionQuery#product</a> to achieve the same however, I'm not sure how to get it to work. I didn't get how to get score multiplied using product function. Trying to get it done, I always get error as field not defined.</p>
  
  <p>Now I can use boost as defined here <a href="https://stackoverflow.com/questions/7701671/how-to-boost-fields-in-solr">How to boost fields in solr</a>, but I have additional logic/requirement where I want to use functional query provided by Solr.</p>
  
  <p>For example, I have tried with following simple query that seems to work</p>
  
  <pre><code>http://solr:8983/solr/select?q=hp%20laptop&amp;defType=edismax&amp;fl=Id,Name,score&amp;bf=product%28$v1,$v2%29&amp;v1=Id&amp;v2=2
  </code></pre>
  
  <p>Now, for my actual requirement, I want to take score as $v2, however I am not able to find how to do this.</p>
  
  <p>Any help is highly appreicated. </p>