首页 文章

Solr 4.3.1数据导入命令

提问于
浏览
0

我目前正在使用Solr 4.3.1 . 我为我的solr配置了dih . 我想通过命令提示符进行完全导入 . 我知道网址会是这样的http://localhost:8983/solr/corename/dataimport?command=full-import&clean=true&commit=true有没有任何方法可以做到这一点而不使用卷曲?

谢谢

编辑

string Text =“http://localhost:8983/solr/Latest_TextBox/dataimport?command=full-import&clean=true&commit=true”; var wc = new WebClient(); var Import = wc.DownloadString(Text);

目前使用上面的代码

2 回答

  • 0

    称之为正常的REST网址就是这样!我在我的应用程序中使用它来导入和索引本地驱动器中的数据,它只是工作正常! :) . 使用HttpURLConnection发出请求并捕获响应,以查看它是否成功 . 您不需要任何特定的API来执行此操作 . 这是在C#中正确发出GET请求的示例代码 . 尝试使用此数据导入处理程序URL,它可能会起作用!

    Console.WriteLine("Making API Call...");
                    using (var client = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }))
                    {
                        client.BaseAddress = new Uri("https://api.stackexchange.com/2.2/");
                        HttpResponseMessage response = client.GetAsync("answers?order=desc&sort=activity&site=stackoverflow").Result;
                        response.EnsureSuccessStatusCode();
                        string result = response.Content.ReadAsStringAsync().Result;
                        Console.WriteLine("Result: " + result);
                    }
                    Console.ReadLine();
                }
            }
        }
    
  • 0

    您必须以某种方式调用URL - Solr仅通过REST API运行 . 没有命令行API(command line tools只能与API通信) . 因此,使用您首选的方式与HTTP endpoints 通信,即 curlwgetGET 或您可以选择的编程语言 .

    捆绑的solrCli应用程序没有任何现有的命令用于触发完全导入,只要我能够看到(通过调用您已经引用的URL与REST API进行对话) .

相关问题