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 Jay Hill <ja...@gmail.com> on 2012/09/17 22:29:53 UTC

Best way to index Solr XML from w/in the same servlet container

I've created a custom process in Solr that has a Zookeeper Watcher
configured to pull Solr XML files from a znode. When I receive a file I can
send the file to /update and get it indexed, but that seems inefficient. I
could use SolrJ, but I believe that is still sending an HTTP request to
/update. Is there a better way to do this, or is SolrJ running w/in the
same servlet container the most efficient way to index SolrJ from w/in the
same servlet container that is running Solr?

Thanks,
-Jay

Re: Best way to index Solr XML from w/in the same servlet container

Posted by Chris Hostetter <ho...@fucit.org>.
: I've created a custom process in Solr that has a Zookeeper Watcher
: configured to pull Solr XML files from a znode. When I receive a file I can
: send the file to /update and get it indexed, but that seems inefficient. I
: could use SolrJ, but I believe that is still sending an HTTP request to
: /update. Is there a better way to do this, or is SolrJ running w/in the
: same servlet container the most efficient way to index SolrJ from w/in the
: same servlet container that is running Solr?

you could use the stream.file option to have the UpdateRequestHandler pull 
the data fro ma local file path, but i'm not sure that would really be 
much faster.  Alternatively you couuld call out directly to hte XMLLoader 
to parse it into SolrInputDocument objects and send them directly to the 
UpdateRequestProcessorChain - depends on how much of hte abstraction you 
want to bypass (ie: if you want to be able to parse multiple types of 
files, you're probably better off talking to hte request handler)

Actually -- using a LocalSolrQueryRequest object where you setup a 
ContentStream pointed at the local file might be the method with the least 
amount of overhaed and the most flexibility.



-Hoss

Re: Best way to index Solr XML from w/in the same servlet container

Posted by ka...@gmx.de.
Hi Jay,

I would like to see the Zookeeper Watcher as part of DIH in solr.
Possible you could extend org.apache.solr.handler.dataimport.DataSource.

If you want to call solr without http you can use solrJ: org.apache.solr.client.solrj.embedded.EmbeddedSolrServer

Beste regards
  Karsten

-------- Original-Nachricht --------
> Datum: Mon, 17 Sep 2012 13:29:53 -0700
> Von: Jay Hill <ja...@gmail.com>
> An: solr-user@lucene.apache.org
> Betreff: Best way to index Solr XML from w/in the same servlet container

> I've created a custom process in Solr that has a Zookeeper Watcher
> configured to pull Solr XML files from a znode. When I receive a file I
> can
> send the file to /update and get it indexed, but that seems inefficient. I
> could use SolrJ, but I believe that is still sending an HTTP request to
> /update. Is there a better way to do this, or is SolrJ running w/in the
> same servlet container the most efficient way to index SolrJ from w/in the
> same servlet container that is running Solr?
> 
> Thanks,
> -Jay