コード例 #1
0
        public void Run(string accessKey)
        {
            Console.WriteLine("EngineExample Running");
            var engineClient = new EngineClient(accessKey);

            if (!engineClient.IsAlive())
            {
                Console.WriteLine("Engine is not running");
                return;
            }

            try
            {
                var result = engineClient.Get("1", 10, new[] { "1" });
                foreach (var res in result.ItemScores)
                {
                    Console.WriteLine("Sync:" + res.Item + " " + res.Score);
                }
                var asyncResult = engineClient.GetAsync("1", 10, new[] { "1" }).Result;
                foreach (var res in asyncResult.ItemScores)
                {
                    Console.WriteLine("Async:" + res.Item + " " + res.Score);
                }
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #2
0
        public void Run(string accessKey)
        {
            Console.WriteLine("EngineExample Running");
            var engineClient = new EngineClient(accessKey);
            if (!engineClient.IsAlive())
            {
                Console.WriteLine("Engine is not running");
                return;
            }

            try
            {
                var result = engineClient.Get("1", 10, new[] { "1" });
                foreach (var res in result.ItemScores)
                {
                    Console.WriteLine("Sync:" + res.Item + " " + res.Score);
                }
                var asyncResult = engineClient.GetAsync("1", 10, new[] { "1" }).Result;
                foreach (var res in asyncResult.ItemScores)
                {
                    Console.WriteLine("Async:" + res.Item + " " + res.Score);
                }
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

        }
コード例 #3
0
        public EngineCustomStatus(EngineClient client)
        {
            if (client == null)
            {
                return;
            }

            if (client.IsAlive())               //engine is alive, get status
            {
                this.IsAlive = true;
                EngineStatus status = client.GetEngineStatus();
                this.ConnectionCount = status.ConnectionCount;
                this.StartTime       = status.StartTime;
                this.Version         = status.Version;
                this.VMSize          = status.VMSize;
                this.Host            = client.Host;
                this.Name            = client.Name;
                this.Port            = client.Port;
                this.SRPC            = GetSRPC(client);
                this.indexesStatus   = client.GetIndexesStatus();
            }
        }