コード例 #1
0
ファイル: SearchController.cs プロジェクト: vinothkummar/SYE
        /// <summary>
        /// loads up the view model with paged data when there is a search string and page number
        /// otherwise it just returns a new view model with a show error flag
        /// </summary>
        /// <param name="search"></param>
        /// <param name="pageNo"></param>
        /// <param name="refinementFacets">comma separated list of selected facets to filter on</param>
        /// <returns></returns>
        private SearchResultsVM GetViewModel(string search, int pageNo, string refinementFacets, bool newSearch)
        {
            var returnViewModel = new SearchResultsVM();

            if (!string.IsNullOrEmpty(search) && pageNo > 0)
            {
                SearchServiceResult searchResult = null;
                try
                {
                    searchResult = _searchService.GetPaginatedResult(search, pageNo, _pageSize, refinementFacets, newSearch).Result;
                }
                catch
                {
                    return(null);//search is not working for some reason
                }
                returnViewModel.Data          = searchResult?.Data?.ToList() ?? new List <SearchResult>();
                returnViewModel.ShowResults   = true;
                returnViewModel.Search        = search;
                returnViewModel.PageSize      = _pageSize;
                returnViewModel.Count         = searchResult?.Count ?? 0;
                returnViewModel.Facets        = SubmissionHelper.ConvertList(searchResult?.Facets);
                returnViewModel.TypeOfService = searchResult?.Facets;
                returnViewModel.CurrentPage   = pageNo;

                if (returnViewModel.Facets != null && (!string.IsNullOrEmpty(refinementFacets)) && !newSearch)
                {
                    foreach (var facet in returnViewModel.Facets)
                    {
                        facet.Selected = (refinementFacets.Contains(facet.Text));
                    }
                }
            }

            return(returnViewModel);
        }
コード例 #2
0
ファイル: NVelocityView.cs プロジェクト: nguyenhuy2911/CMS
 private void AddCMSHelpers(Hashtable entries)
 {
     entries["ViewHelper"]       = new ViewHelper();
     entries["MenuHelper"]       = new MenuHelper();
     entries["SubmissionHelper"] = new SubmissionHelper();
     entries["ServiceFactory"]   = new Kooboo.CMS.Sites.Services.ServiceFactory();
     entries["Page_Context"]     = Page_Context.Current;
     entries["ContentHelper"]    = new ContentHelper();
     entries["Repository"]       = Repository.Current;
     entries["SearchHelper"]     = new NVelocitySearchHelper();
 }
コード例 #3
0
        private static void EnsembleExp()
        {
            SubmissionHelper.Ensemble(@"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\output-cosmos\ensemble\pred_f13.txt",
                                      @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\output-cosmos\ensemble\pred_f15.txt",
                                      @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\output-cosmos\ensemble\output\ensemble01.txt", 1, 100, 0);


            SubmissionHelper.Ensemble(@"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\output-cosmos\ensemble\user_viewed.txt",
                                      @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\output-cosmos\ensemble\output\ensemble01.txt",
                                      @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\output-cosmos\ensemble\output\ensemble02.txt", 1, 100, 50);

            SubmissionHelper.Ensemble(@"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\output-cosmos\ensemble\output\ensemble02.txt",
                                      @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\output-cosmos\ensemble\pred_f11.txt",
                                      @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\output-cosmos\ensemble\output\ensemble03.txt", 1, 100, 100);
        }
コード例 #4
0
        private static void MakeSubmission()
        {
            //SubmissionHelper.GenSubFileFromTLC(@"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\TLC2\4.inst.txt", @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\submit\FT_1_0.2_2000_V4.txt", 0, 2, 0.1);
            //SubmissionHelper.GenSubFileFromTLC(@"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\TLC\fastrank.inst.txt", @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\TLC\fastrank.txt", 0, 3, -100);
            //SubmissionHelper.GenSubFileFromTLC(@"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\TLC\0.inst.txt",
            //    @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\TLC\fastrank_0.txt", new int[] { 0, 1 }, 3, -100);

            SubmissionHelper.GenSubFileFromTLC(@"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\TLC\LR_local_complete_0.inst.txt",
                                               @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\submit\lr.localmodel02.txt", new int[] { 0 }, 2, -100, '\t', true);

            //SubmissionHelper.GenSubFileFromTLCWithAlignment(@"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\TLC\0.inst.txt",
            //    @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\test_complete_0_format.csv",
            //    @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\TLC\fastrank_0.txt");

            //ReplaceGroupId(@"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\TLC\fastrank_0.txt",
            //    @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\train-test\inter-media\feature\TLC\fastrank_0_submit.txt",
            //    @"\\mlsdata\e$\Users\v-lianji\mlsdata\Recsys17\submit\fastrank_0.txt");
        }
コード例 #5
0
        private static void Test()
        {
            int topk = 1000;
            int s    = 0;

            topk = 1500;
            SubmissionHelper.SelectTopInstances(topk, s, 2);
            SubmissionHelper.Evaluate(@"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\tlc\submission_" + topk + "_" + s + ".txt",
                                      @"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\valid_lr_80");



            topk = 1800;
            SubmissionHelper.SelectTopInstances(topk, s, 2);
            SubmissionHelper.Evaluate(@"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\tlc\submission_" + topk + "_" + s + ".txt",
                                      @"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\valid_lr_80");



            topk = 2100;
            SubmissionHelper.SelectTopInstances(topk, s, 30);
            SubmissionHelper.Evaluate(@"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\tlc\submission_" + topk + "_" + s + ".txt",
                                      @"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\valid_lr_80");

            topk = 2400;
            SubmissionHelper.SelectTopInstances(topk, s, 30);
            SubmissionHelper.Evaluate(@"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\tlc\submission_" + topk + "_" + s + ".txt",
                                      @"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\valid_lr_80");

            topk = 2700;
            SubmissionHelper.SelectTopInstances(topk, s, 30);
            SubmissionHelper.Evaluate(@"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\tlc\submission_" + topk + "_" + s + ".txt",
                                      @"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\valid_lr_80");

            topk = 3000;
            SubmissionHelper.SelectTopInstances(topk, s, 30);
            SubmissionHelper.Evaluate(@"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\tlc\submission_" + topk + "_" + s + ".txt",
                                      @"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\valid_lr_80");

            topk = 3300;
            SubmissionHelper.SelectTopInstances(topk, s, 30);
            SubmissionHelper.Evaluate(@"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\tlc\submission_" + topk + "_" + s + ".txt",
                                      @"\\mlsdata\e$\Users\v-lianji\others\CIKM16\my\Data4Report\features\train-valid\valid_lr_80");
        }