lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darniz <rnizamud...@edmunds.com>
Subject Inserting documents using get method
Date Wed, 16 Nov 2011 01:46:42 GMT
Hello All,
i am trying to insert document using the server.addBean(obj) method. somehow
i am getting HTTP error 411 Length required. After trying a lot i decided to
change my method from post to get.

if i open a browser and execute this query
mysolrserver/solr/update?stream.body=<add><doc><field
name="id">test</field><field name="c_title">Test</field><field
name="site">L</field></doc></add>

it works which gives me a sense that the get request is working.Aslo i am
able to retreive documents

My question is whether the server.addBean(obj) uses post request or get
request behind the scene. If it uses post method isthere a way i can
configure CommonsHttpSolrServerit to insert document using  get method. 

Right now this is the below code which is failing
 server =new CommonsHttpSolrServer("http://www.mysolrserver.com/solr");
 Credentials def =   new UsernamePasswordCredentials("xxx","xxx");
 server.getHttpClient().getState().setCredentials(AuthScope.ANY,def);
 server.getHttpClient().getParams().setAuthenticationPreemptive(true);
 for (Obj obj:objects){
    server.addBean(obj);
}

Thanks
darniz

--
View this message in context: http://lucene.472066.n3.nabble.com/Inserting-documents-using-get-method-tp3511499p3511499.html
Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message