public void TestDocDetail()
        {
            var target = new CloudsearchDoc(ApplicationName, api);

            target.Add("[{'id':1,'author':'nathan'}]").Push("es_journal");

            var result = target.Detail("id", "1");

            Assert.AreEqual("OK", result.Status);

            target.Remove("1").Push("main");
            result = target.Detail("id", "1");
            Assert.AreEqual("OK", result.Status);
        }
Esempio n. 2
0
        public DataResponse Detail(string docId, string pkField = "id")
        {
            CloudsearchDoc target = GetSearchDocApi();
            var            result = target.Detail(pkField, docId);

            return(result);
        }
        public void TestDocBatchSubmit()
        {
            var target = new CloudsearchDoc(ApplicationName, mockApi); // TODO: 初始化为适当的值

            var docToAdd = new Dictionary <string, object>();

            docToAdd["K1"] = "k1";
            docToAdd["K2"] = "k2";
            docToAdd["id"] = "1";

            var docToUpdate = new Dictionary <string, object>();

            docToUpdate["K1"] = "k1";
            docToUpdate["K2"] = "k2";
            docToUpdate["id"] = "2";

            var result = target.Remove("999", "1").Add(docToAdd).Update(docToUpdate).Push("es_journal");

            Assert.AreEqual("OK", result.Status);

            var detail = target.Detail("id", "1");

            Assert.AreEqual("OK", detail.Status);
        }