On 7/8/2013 11:10 PM, Learner wrote:
> 
> I wrote a custom data import handler to import data from files. I am trying
> to figure out a way to make asynchronous call instead of waiting for the
> data import response. Is there an easy way to invoke asynchronously  (other
> than using futures and callables) ?
> 
> public class CustomFileImportHandler extends RequestHandlerBase implements
> SolrCoreAware{
>       public void handleRequestBody(SolrQueryRequest arg0, SolrQueryResponse
> arg1){
>        indexer a= new indexer(""); // constructor
>        String status= a.Index(); // method to do indexing, trying to make it
> async
> }
> }

Generally speaking, it's easier to write a separate program than write a
Solr plugin, unless you just want to add a tiny tweak to an existing
class and not make fundamental changes in how it works.  The dataimport
handler is designed around a model of starting and frequently checking
the status to know whether it's done.

For what you want to do, I'd write a subroutine, module, or a separate
program using a Solr API for your language that obtains the data from
the source and indexes it to Solr directly.  This is definitely the
preferred method if your code is written in Java, but it's generally the
right way to go no matter what language you're using.

Thanks,
Shawn

Reply via email to