예제 #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Running search...");
            if (args.Length < 1)
            {
                Console.WriteLine("Must specify a search string text as first parameter");
                Console.WriteLine("Usage: cssearch.exe <querytext>");
                Console.WriteLine("Example Usage: cssearch.exe wibble");
                return;
            }

            Connection conn = new mlclient.Connection();

            conn.configure("192.168.123.4", "8122", "admin", "admin", false);

            SearchDescription desc = new SearchDescription();

            desc.setQueryText(args[0]);
            Response response = conn.search(desc);

            Console.WriteLine("  Response Type: ");
            Console.WriteLine("  Response Code: ");
            Console.WriteLine("  Response Content: ");

            Console.WriteLine("Search Results:-");
            Console.WriteLine(response.getContent());

            Console.WriteLine("search complete");
            return;
        }
예제 #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Running csbatchupload...");

            if (args.Length < 2)
            {
                Console.WriteLine("Must specify the root load folder as first parameter");
                Console.WriteLine("Must specify the collection as second parameter");
                Console.WriteLine("Usage: csbatchupload <folder> <collection>");
                Console.WriteLine("Example Usage: csbatchupload ./some/folder mydocs");
                return;
            }

            UploadObserver obs = new UploadObserver();

            Connection conn = new mlclient.Connection();

            conn.configure("192.168.123.4", "8122", "admin", "admin", false);

            DocumentBatchWriter writer = new DocumentBatchWriter(conn);

            writer.addBatchListener(obs);
            CollectionSet colList = new CollectionSet();

            colList.Add(args[1]);
            PermissionSet permList = new PermissionSet();
            Permission    perm     = new Permission("admin", Capability.EXECUTE);

            permList.Add(perm);

            DocumentSet set = new DocumentSet();

            DocumentBatchHelper.addFilesToDocumentSet(args[0], args[0], true, "/csbatchupload/",
                                                      colList, permList, null, set);
            long setSize = set.Count;

            Console.WriteLine("Document Set Size: " + setSize);

            writer.assignDocuments(set);
            writer.send();

            writer.wait();

            //Thread.Sleep(5000); // hack around multi-threading issues


            Console.WriteLine("Exception is nullptr?: " + (null == obs.ex));              // TODO extract exception once STL is supported

            Progress p = writer.getProgress();

            Console.WriteLine("Document set size: " + setSize + ", complete size: " + p.completed);
            Console.WriteLine("Progress: Complete: " + p.completed + ", total: " + p.total + ", pct: " + p.percentageComplete);
            Console.WriteLine("Progress: duration: " + p.duration + ", est remaining duration: "
                              + p.durationEstimateRemaining);
            Console.WriteLine("Progress: Overall rate: " + p.rate);

            Console.WriteLine("batch upload complete");
        }
예제 #3
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Running csgetdoc...");

            mlclient.Connection conn = new mlclient.Connection();
            conn.configure("192.168.123.4", "8122", "admin", "admin", false);
            string uri = "/some/doc.json";

            Console.WriteLine("Fetching: " + uri);
            mlclient.Response     resp = conn.getDocument(uri);
            mlclient.ResponseType rt   = resp.getResponseType();
            Console.WriteLine("Response Type: " + rt.ToString());
            if (mlclient.ResponseType.JSON == rt)
            {
                Console.WriteLine("This is a JSON document");
            }
            if (mlclient.ResponseType.XML == rt)
            {
                Console.WriteLine("This is an XML document");
            }
            Console.WriteLine(resp.getContent());
        }