Hi All,
 
I am trying to index documents by using solrj client. I have written a
simple code below,
 
{            
            CommonsHttpSolrServer server =   new
CommonsHttpSolrServer("http://localhost:8080/solr/update";);
            SolrInputDocument doc1=new SolrInputDocument();
            doc1.addField( "id", "id1", 1.0f );
            doc1.addField( "name", "doc1", 1.0f );
            doc1.addField( "price", 10 );        
            SolrInputDocument doc2 = new SolrInputDocument();
            doc2.addField( "id", "id2", 1.0f );
            doc2.addField( "name", "doc2", 1.0f );
            doc2.addField( "price", 20 );
            Collection<SolrInputDocument> docs = new
ArrayList<SolrInputDocument>();
            docs.add( doc1 );
            docs.add( doc2 );        
            server.add(docs);
            server.commit();
}
 
But I am getting the below error, Can anyone tell me what is the wrong with
the above code.
 
Exception in thread "main" java.lang.RuntimeException: Invalid version or
the data in not in 'javabin' format
        at
org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:98)
        at
org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(Binar
yResponseParser.java:39)
        at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
olrServer.java:470)
        at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpS
olrServer.java:245)
        at
org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.jav
a:243)
        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:48)
        at SolrIndexTest.main(SolrIndexTest.java:46)
Java Result: 1

Reply via email to