You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by T Vinod Gupta <tv...@readypulse.com> on 2012/02/09 22:00:27 UTC

correct usage of StreamingUpdateSolrServer?

Hi,
I wrote a hello world program to add documents to solr server. When I
use CommonsHttpSolrServer, the program exits but when I
use StreamingUpdateSolrServer, the program never exits. And I couldn't find
a way to close it? Are there any best practices here? Do I have to do
anything differently at the time of documents adds/updates when
using StreamingUpdateSolrServer? I am following the add/commit cycle. Is
that ok?

thanks

Re: correct usage of StreamingUpdateSolrServer?

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Whats the output of jstack $PID ?
If the program does not exit, there must be some non-daemon threads
still running.


Re: correct usage of StreamingUpdateSolrServer?

Posted by Erick Erickson <er...@gmail.com>.
Well, that's certainly "hello world" <G>.

But I'm kinda stumped, I have programs that look an awful lot like
this that terminate just fine.

Anything in your Solr logs? And are you just executing this once?
And what version of Solr are you using?

Best
Erick

On Fri, Feb 10, 2012 at 3:49 PM, T Vinod Gupta <tv...@readypulse.com> wrote:
> here is how i was playing with it..
>
>        StreamingUpdateSolrServer solrServer = new
> StreamingUpdateSolrServer("http://localhost:8983/solr/", 10, 1);
>
>        SolrInputDocument doc1 = new SolrInputDocument();
>        doc1.addField( "pk_id", "id1");
>        doc1.addField("doc_type", "content");
>        doc1.addField( "id", "1");
>        doc1.addField( "content_text", "hello world" );
>
>        Collection<SolrInputDocument> docs = new
> ArrayList<SolrInputDocument>();
>        docs.add(doc1);
>        solrServer.add(docs);
>        solrServer.commit();
>
> thanks
>
> On Fri, Feb 10, 2012 at 7:41 AM, Erick Erickson <er...@gmail.com>wrote:
>
>> Can you post the code? SUSS should essentially be a drop-in
>> replacement for CHSS.
>>
>> It's not advisable to commit after every add, it's usually better
>> to use commitWithin, and perhaps commit at the very end of
>> the run.
>>
>> Best
>> Erick
>>
>> On Thu, Feb 9, 2012 at 4:00 PM, T Vinod Gupta <tv...@readypulse.com>
>> wrote:
>> > Hi,
>> > I wrote a hello world program to add documents to solr server. When I
>> > use CommonsHttpSolrServer, the program exits but when I
>> > use StreamingUpdateSolrServer, the program never exits. And I couldn't
>> find
>> > a way to close it? Are there any best practices here? Do I have to do
>> > anything differently at the time of documents adds/updates when
>> > using StreamingUpdateSolrServer? I am following the add/commit cycle. Is
>> > that ok?
>> >
>> > thanks
>>

Re: correct usage of StreamingUpdateSolrServer?

Posted by T Vinod Gupta <tv...@readypulse.com>.
here is how i was playing with it..

        StreamingUpdateSolrServer solrServer = new
StreamingUpdateSolrServer("http://localhost:8983/solr/", 10, 1);

        SolrInputDocument doc1 = new SolrInputDocument();
        doc1.addField( "pk_id", "id1");
        doc1.addField("doc_type", "content");
        doc1.addField( "id", "1");
        doc1.addField( "content_text", "hello world" );

        Collection<SolrInputDocument> docs = new
ArrayList<SolrInputDocument>();
        docs.add(doc1);
        solrServer.add(docs);
        solrServer.commit();

thanks

On Fri, Feb 10, 2012 at 7:41 AM, Erick Erickson <er...@gmail.com>wrote:

> Can you post the code? SUSS should essentially be a drop-in
> replacement for CHSS.
>
> It's not advisable to commit after every add, it's usually better
> to use commitWithin, and perhaps commit at the very end of
> the run.
>
> Best
> Erick
>
> On Thu, Feb 9, 2012 at 4:00 PM, T Vinod Gupta <tv...@readypulse.com>
> wrote:
> > Hi,
> > I wrote a hello world program to add documents to solr server. When I
> > use CommonsHttpSolrServer, the program exits but when I
> > use StreamingUpdateSolrServer, the program never exits. And I couldn't
> find
> > a way to close it? Are there any best practices here? Do I have to do
> > anything differently at the time of documents adds/updates when
> > using StreamingUpdateSolrServer? I am following the add/commit cycle. Is
> > that ok?
> >
> > thanks
>

Re: correct usage of StreamingUpdateSolrServer?

Posted by Erick Erickson <er...@gmail.com>.
Can you post the code? SUSS should essentially be a drop-in
replacement for CHSS.

It's not advisable to commit after every add, it's usually better
to use commitWithin, and perhaps commit at the very end of
the run.

Best
Erick

On Thu, Feb 9, 2012 at 4:00 PM, T Vinod Gupta <tv...@readypulse.com> wrote:
> Hi,
> I wrote a hello world program to add documents to solr server. When I
> use CommonsHttpSolrServer, the program exits but when I
> use StreamingUpdateSolrServer, the program never exits. And I couldn't find
> a way to close it? Are there any best practices here? Do I have to do
> anything differently at the time of documents adds/updates when
> using StreamingUpdateSolrServer? I am following the add/commit cycle. Is
> that ok?
>
> thanks