0

I need to schedule a Windows task that will invoke Solr DataImportHandler command. So I decided to create a console app which will invoke the DataImportHandler command using WebClient. However, this simple code does not seem to work for me. The uri works independently but not from the console app. What am I doing wrong? Please help. (I have tried DownloadString as well).

using (WebClient client = new WebClient())
{              
    var uri = "http://localhost:8983/solr/#/collection1/dataimport//dataimport?command=full-import&clean=true&commit=true";
    client.OpenRead(uri);               
}

1 Answers1

0

Why not use dataimport scheduler (expained in DIH wiki page)?

Marko Bonaci
  • 5,622
  • 2
  • 34
  • 55
  • That is a Java based program, right? My area is .Net and it will perhaps take me a long time to get that up and running. Getting Solr started took me a while. – user2078017 Nov 08 '13 at 10:20
  • Ups, did not check. You can try using UploadValues method instead of OpenRead and prepare NameValueCollection with your Url params), like this: http://stackoverflow.com/a/4088699/465710 – Marko Bonaci Nov 09 '13 at 19:59