Beispiel #1
0
        public static void ValidateIndex(SearchServiceClient serviceClient, string indexName, long numDocsIndexed)
        {
            ISearchIndexClient indexClient = serviceClient.Indexes.GetClient(indexName);

            long indexDocCount = indexClient.Documents.Count();

            while (indexDocCount != numDocsIndexed)
            {
                Console.WriteLine("Waiting for document count to update...\n");
                Thread.Sleep(2000);
                indexDocCount = indexClient.Documents.Count();
            }
            Console.WriteLine("Document Count is {0}\n", indexDocCount);


            IndexGetStatisticsResult indexStats = serviceClient.Indexes.GetStatistics(indexName);

            while (indexStats.DocumentCount != numDocsIndexed)
            {
                Console.WriteLine("Waiting for service statistics to update...\n");
                Thread.Sleep(10000);
                indexStats = serviceClient.Indexes.GetStatistics(indexName);
            }
            Console.WriteLine("Index Statistics: Document Count is {0}", indexStats.DocumentCount);
            Console.WriteLine("Index Statistics: Storage Size is {0}\n", indexStats.StorageSize);
        }
Beispiel #2
0
        public void CanCreateAndGetIndexStats()
        {
            Run(() =>
            {
                SearchServiceClient searchClient = Data.GetSearchServiceClient();

                Index index = CreateTestIndex();

                searchClient.Indexes.Create(index);

                IndexGetStatisticsResult stats = searchClient.Indexes.GetStatistics(index.Name);
                Assert.Equal(0, stats.DocumentCount);
                Assert.Equal(0, stats.StorageSize);
            });
        }