Solr Boosting specific field values
<p>I'm trying to boost the score for documents returned from a search in solr.</p>
<p>The boost I want to achieve is something along the lines of:</p>
<pre><code>field1:(value1)^5 OR field2:(value2)^2 
</code></pre>
<p><strong>If the document does have field1 matching value1, boost by 5.
If document does have field2 matching value2, boost by 2.</strong></p>
<p>The documents have many fields, let's call them field1, field2... and may be missing certain fields.</p>
<p>The documents do not need to have field1 or field2 matching value1, value2 respectively.</p>
<p>I have other filter queries such as:</p>
<pre><code>fq: field1:[* TO *]  &lt;- checking for presence of

fq: field3: (&quot;something&quot; &quot;somethingelse&quot;)

fq: field4: 1
</code></pre>
<p>I am grouping my results by a certain field not being used in any of the queries.</p>
<p>Raw query parameters:</p>
<pre><code>group=true&amp;group.facet=true&amp;group.field=anIndependentField
</code></pre>
<p>I am using the same fq's with tried different query parsers.</p>
<p>There are enough documents in solr with field1:value1 and/or field2:value2 as well as other values for those fields.</p>
<p>So far I've tried using the query parsers:</p>
<ol>
<li>Standard Query Parser</li>
</ol>
<blockquote>
<p>method a) q: field1:(value1)^5 OR field2:(value2)^2 // no results</p>
<p>method b) q: *:* OR field1:(value1)^5 OR field2:(value2)^2 // no results</p>
<p>method c) q: (value1)^5 OR (value2)^2  // incorrect. looks for complete match.</p>
<p>method d) q: (value1)^5 (value2)^2 // incorrect. looks for complete match</p>
</blockquote>
<ol start="2">
<li>EDisMax Query Parser</li>
</ol>
<p>(defType=edismax)</p>
<p>q: *:*</p>
<pre><code>bq: field1:(value1)^5 OR field2:(value2)^2 
</code></pre>
<p>Problem with this one is that results are not in expected order.
A document that has field1:somethingElse and field2:somethingElse2 got a higher score than a document that has field1: somethingElse and field2:value2.</p>
<p>Can anyone see what I'm doing wrong or has a suggestion to improve the relevancy of my search queries?</p>