title: Adding pdf document to Solr in Java
body: <p>I can add field like this in <code>Java</code>, but I want to add pdf document to <code>Solr</code> with SolrJ in <code>Java</code>, how can I add a pdf file?</p>
  
  <pre><code>CommonsHttpSolrServer server = new CommonsHttpSolrServer("http://localhost:8983/solr");
  
  SolrInputDocument doc = new SolrInputDocument();
  
  doc.addField("cat", "lalal");
  doc.addField("id", "1");
  
  server.add(doc);
  server.commit();
  </code></pre>