static void TestAddTone() { var updateHandler = SolrServerInstance.ToneServer.GetHandler <SolrUpdateHandler>(); var request = new SolrUpdateRequest(); //request.commit = "true"; request.RequestMethod = SolrUpdateRequestMethod.Add; request.docs.Add(new ToneDocument() { id = "1", tone = "negative", title = "aa", content = "bb" }); request.docs.Add(new ToneDocument() { id = "2", tone = "negative", title = "aaaa", content = "bbbb" }); var response = updateHandler.Request(request); response.Wait(); var d = response.Result.GetData <SolrResponseHeader>("responseHeader"); Assert.IsTrue(d.Status >= 0); }
static void TestToneCommit() { var updateHandler = SolrServerInstance.ToneServer.GetHandler <SolrUpdateHandler>(); var request = new SolrUpdateRequest(); var response = updateHandler.Commit(); response.Wait(); var d = response.Result.GetData <SolrResponseHeader>("responseHeader"); Assert.IsTrue(d.Status >= 0); }
static void UpdateDocumentTone(string id) { var updateHandler = SolrServerInstance.ToneServer.GetHandler <SolrUpdateHandler>(); var request = new SolrUpdateRequest(); request.RequestMethod = SolrUpdateRequestMethod.Set; request.docs.Add(new ToneDocument() { id = id.ToString(), tone = "positive" }); var response = updateHandler.Request(request); response.Wait(); var d = response.Result.GetData <SolrResponseHeader>("responseHeader"); Assert.IsTrue(d.Status >= 0); }
static void TestAddDocument() { var docs = new List <Document.Document>(); var updateHandler = SolrServerInstance.NewsServer.GetHandler <SolrUpdateHandler>(); updateHandler.Collection = "web"; var request = new SolrUpdateRequest(); request.RequestMethod = SolrUpdateRequestMethod.Add; request.docs.AddRange(docs); var response = updateHandler.Request(request); response.Wait(); var d = response.Result.GetData <SolrResponseHeader>("responseHeader"); Assert.IsTrue(d.Status >= 0); }
static void TestToneDelete() { var updateHandler = SolrServerInstance.ToneServer.GetHandler <SolrUpdateHandler>(); var request = new SolrUpdateRequest(); request.commit = "true"; request.RequestMethod = SolrUpdateRequestMethod.Delete; request.docs.Add(new ToneDocument() { id = "1" }); request.docs.Add(new ToneDocument() { id = "2" }); var response = updateHandler.Request(request); response.Wait(); var d = response.Result.GetData <SolrResponseHeader>("responseHeader"); Assert.IsTrue(d.Status >= 0); }