title: How to boost a SOLR document when indexing with /solr/update
body: <p>To index my website, I have a Ruby script that in turn generates a shell script that uploads every file in my document root to Solr. The shell script has many lines that look like this:</p>
  
  <pre><code>  curl -s \
   "http://localhost:8983/solr/update/extract?literal.id=/about/core-team/&amp;commit=false" \
   -F "myfile=@/extra/www/docroot/about/core-team/index.html"
  </code></pre>
  
  <p>...and ends with:</p>
  
  <pre><code>curl -s http://localhost:8983/solr/update --data-binary \
  '&lt;commit/&gt;' -H 'Content-type:text/xml; charset=utf-8'
  </code></pre>
  
  <p>This uploads all documents in my document root to Solr. I  use <a href="http://wiki.apache.org/solr/ExtractingRequestHandler" rel="nofollow">tika and ExtractingRequestHandler</a> to upload documents in various formats (primarily PDF and HTML) to Solr.</p>
  
  <p>In the script that generates this shell script, I would like to boost certain documents based on whether their id field (a/k/a url) matches certain regular expressions. </p>
  
  <p>Let's say that these are the boosting rules (pseudocode):</p>
  
  <pre><code>boost = 2 if url =~ /cool/
  boost = 3 if url =~ /verycool/
  # otherwise we do not specify a boost
  </code></pre>
  
  <p>What's the simplest way to add that index-time boost to my http request?</p>
  
  <p>I tried:</p>
  
  <pre><code>curl -s \
   "http://localhost:8983/solr/update/extract?literal.id=/verycool/core-team/&amp;commit=false" \
   -F "myfile=@/extra/www/docroot/verycool/core-team/index.html" \
   -F boost=3
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>curl -s \
   "http://localhost:8983/solr/update/extract?literal.id=/verycool/core-team/&amp;commit=false" \
   -F "myfile=@/extra/www/docroot/verycool/core-team/index.html" \
   -F boost.id=3
  </code></pre>
  
  <p>Neither made a difference in the ordering of search results. What I want is for the boosted results to come first in search results, regardless of what the user searched for (provided of course that the document contains their query). </p>
  
  <p>I understand that if I POST in XML format I can specify the boost value for either the entire document or a specific field. But If I do that, it isn't clear how to specify a file as the document contents. Actually, the <a href="http://wiki.apache.org/solr/ExtractingRequestHandler" rel="nofollow">tika page</a> provides a partial example:</p>
  
  <pre><code>curl "http://localhost:8983/solr/update/extract?literal.id=doc5&amp;defaultField=text" \
  --data-binary @tutorial.html -H 'Content-type:text/html'
  </code></pre>
  
  <p>But again it isn't clear where/how to specify my boost. I tried:</p>
  
  <pre><code>curl \ 
  "http://localhost:8983/solr/update/extract?literal.id=mydocid&amp;defaultField=text&amp;boost=3"\
  --data-binary @mydoc.html -H 'Content-type:text/html'
  </code></pre>
  
  <p>and</p>
  
  <pre><code>curl \ 
  "http://localhost:8983/solr/update/extract?literal.id=mydocid&amp;defaultField=text&amp;boost.id=3"\
  --data-binary @mydoc.html -H 'Content-type:text/html'
  </code></pre>
  
  <p>Neither of which altered search results.</p>
  
  <p>Is there a way to update just the boost attribute of a document (not a specific field) without altering the document contents? If so, I could accomplish my goal in two steps:
  1) Upload/index document as I have been doing
  2) Specify boost for certain documents</p>