lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew May <a...@ingenta.com>
Subject Re: Doc add limit
Date Fri, 28 Jul 2006 17:41:07 GMT
I'm using HttpClient for indexing and searching and it seems to work well. You can either 
POST files directly (only works in 3.1 alpha, use InputStreamRequestEntity in 3.0):

       PostMethod post = new PostMethod(solrUrl);
       post.setRequestEntity(new FileRequestEntity(file, "application/xml"));
       int response = new HttpClient().executeMethod(post);

or send a String (e.g. the result of an XSLT transformation)

       PostMethod post = new PostMethod(solrUrl);
       post.setRequestEntity(new StringRequestEntity(text, "application/xml", "UTF-8"));
       int response = new HttpClient().executeMethod(post);

You can also pool connections if you're writing something multi-threaded.

-Andrew

Bertrand Delacretaz wrote:
> On 7/28/06, Yonik Seeley <yonik@apache.org> wrote:
> 
>> ...Getting all the little details of connection handling correct can be
>> tough... it's probably a good idea if we work toward common client
>> libraries so everyone doesn't have to reinvent them....
> 
> Jakarta's HttpClient [1] is IMHO a good base for Java clients, and
> it's easy to use, see the PostXML example in [2].
> 
> -Bertrand
> 
> [1] http://jakarta.apache.org/commons/httpclient/
> 
> [2] 
> http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/examples/PostXML.java?revision=410848&view=markup

> 

Mime
View raw message