예제 #1
0
        public static SearchResult Search(QueryRequest request)
        {
            var search  = new FlnSearch.AwsSearch();
            var results = search.DoSearch(request);

            return(results);
        }
예제 #2
0
        private static BulkLoadResponse LoadIndex(string fileName)
        {
            var bulkResponse   = new BulkLoadResponse();
            int recordsPerLoad = 5000;

            var orders = GetAllOrders(fileName);
            var search = new FlnSearch.AwsSearch();

            var remainingCount = orders.Count();
            var startIndex     = 0;

            while (remainingCount > 0)
            {
                var count = remainingCount > recordsPerLoad ? recordsPerLoad : remainingCount;
                var batch = orders.GetRange(startIndex, count);

                Console.WriteLine(string.Format("\tprocessing records :{0} thru {1}...", startIndex, startIndex + count));
                var response = search.BulkLoad(batch);
                bulkResponse.RecordsInBatch += response.RecordsInBatch;
                Console.WriteLine(string.Format("\t\tProcess took: {0}", response.Took));

                if (response.Errors)
                {
                    bulkResponse.Errors = true;
                    bulkResponse.FailedItems.AddRange(response.FailedItems);
                    Console.WriteLine(string.Format("\t{0} errors found", response.FailedItems.Count));
                }

                remainingCount -= count;
                startIndex     += count;
            }
            return(bulkResponse);
        }
예제 #3
0
        public static void BulkDelete(QueryRequest request)
        {
            var search   = new FlnSearch.AwsSearch();
            var response = search.BulkDelete(request);

            Console.WriteLine(string.Format("\t\tRecords deleted:{0}", response.Deleted));
        }
예제 #4
0
        private static void LoadRange(string fileName, int startIndex, int count)
        {
            var orders = GetAllOrders(fileName);
            var seaexh = new FlnSearch.AwsSearch();

            var batch = orders.GetRange(startIndex, count);

            seaexh.BulkLoad(batch);
        }
예제 #5
0
        private static void LoadData()
        {
            var search = new FlnSearch.AwsSearch();

            search.LoadDataFromSource(DateTime.Now.AddMinutes(-5), DateTime.Now.AddDays(1));

            //    var bulkResponse = LoadIndex(@"C:\Users\Niels Hansen\Documents\Visual Studio 2012\Projects\FlnSearch\SearchTester\file1.rpt");
            //    Console.WriteLine(string.Format("Processes file:{0} records processed. Total errors: {1}", bulkResponse.RecordsInBatch, bulkResponse.FailedItems.Count));
            //    Console.WriteLine("loading file...");
            //    bulkResponse = LoadIndex(@"C:\Users\Niels Hansen\Documents\Visual Studio 2012\Projects\FlnSearch\SearchTester\file2.rpt");
            //    Console.WriteLine(string.Format("Processes file:{0} records processed. Total errors: {1}", bulkResponse.RecordsInBatch, bulkResponse.FailedItems.Count));
            //    Console.WriteLine("loading file...");
            //    bulkResponse = LoadIndex(@"C:\Users\Niels Hansen\Documents\Visual Studio 2012\Projects\FlnSearch\SearchTester\file3.rpt");
            //    Console.WriteLine(string.Format("Processes file:{0} records processed. Total errors: {1}", bulkResponse.RecordsInBatch, bulkResponse.FailedItems.Count));
        }
예제 #6
0
        public static void CreateIndex(string name)
        {
            var search = new FlnSearch.AwsSearch();

            search.GenerateIndex(name);
        }
예제 #7
0
        public static void DeleteIndex(string name)
        {
            var search = new FlnSearch.AwsSearch();

            search.DeleteIndex(name);
        }