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 Karan Saini <ma...@gmail.com> on 2017/12/11 11:40:53 UTC

Solr :: How to trigger the DIH from SolrNet API with C# code

Hi guys,

*Solr Version :: 6.6.1*
API :: SolrNet with C# based application

I wish to invoke or trigger the data import handler from the C# code with
the help of SolrNet. But i am unable to locate any tutorial in the SolrNet
API.

Please suggest how do i invoke the data import action from the C# based
application ?

Regards,
Karan

Re: Solr :: How to trigger the DIH from SolrNet API with C# code

Posted by Karan_Saini <ma...@gmail.com>.
I finally did myself and used the *C# class HttpClient* to make the web
request for the Solr API URL as follows.


  string solrTargetDIHUrl =
"http://localhost:8983/solr/dih/dataimport?command=delta-import";

            ////Makes Async call to the Web API URL & trigger the data
import handler action.
            try
            {                
                using (var solrClient = new HttpClient())
                {
                    var resultObj = solrClient.GetAsync(new
Uri(solrTargetDIHUrl)).Result;
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("\t\t Data Import Triggered
Successfully !");
                    Console.ResetColor();

                }
            }
            catch(Exception ex)
            {
                Console.WriteLine("ERROR in DIH Trigger >>>>> " + ex.Message
+ "||" + ex.StackTrace);
            }



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Solr :: How to trigger the DIH from SolrNet API with C# code

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/11/2017 4:40 AM, Karan Saini wrote:
> *Solr Version :: 6.6.1*
> API :: SolrNet with C# based application
>
> I wish to invoke or trigger the data import handler from the C# code with
> the help of SolrNet. But i am unable to locate any tutorial in the SolrNet
> API.
>
> Please suggest how do i invoke the data import action from the C# based
> application ?

That would be a question for whoever wrote SolrNet.  It was *not* the
Solr project.

https://github.com/SolrNet/SolrNet/issues

If people involved with that project need help with what Solr expects
and what it sends back, they can come to this list.

Thanks,
Shawn