On 8/19/2010 1:45 AM, Lance Norskog wrote:
'stream.url' is just a simple parameter. You should be able to just
add it directly.


I agree (code excluding imports):

public class CommonTest {

  public static void main(String[] args) {
System.out.println("main...");
    try {
String fileName = String fileName = "http://remoteserver/test/test.pdf";;
      String solrId = "1234";
      indexFilesSolrCell(fileName, solrId);

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }

  /**
   * Method to index all types of files into Solr.
   * @param fileName
   * @param solrId
   * @throws IOException
   * @throws SolrServerException
   */
  public static void indexFilesSolrCell(String fileName, String solrId)
    throws IOException, SolrServerException {

System.out.println("indexFilesSolrCell...");

    String urlString = "http://localhost:9080/solr";;

System.out.println("getting connection...");
    SolrServer solr = new CommonsHttpSolrServer(urlString);

System.out.println("getting updaterequest handle...");
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");

System.out.println("setting params...");
    req.setParam("stream.url", fileName);
    req.setParam("literal.content_id", solrId);

System.out.println("making request...");
    solr.request(req);

System.out.println("committing...");
    solr.commit();

System.out.println("done...");
  }
}


At "making request" I get:

java.lang.NullPointerException
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:381) at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:243)
        at CommonTest.indexFilesSolrCell(CommonTest.java:59)
        at CommonTest.main(CommonTest.java:26)

... which is pointing to the solr.request(req) line.



Thanks - Tod

Reply via email to