public void ProcessContentSearchRequest(NSNotification obj) { var hud = new MTMBProgressHUD(View) { LabelText = "Loading", RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(animated: true); string keyword = SearchBar.Text; SearchResult res = SearchUtil.Search(AppDataUtil.Instance.GetCurrentPublication().BookId, AppDataUtil.Instance.GetOpendTOC().ID, keyword); if (AppDisplayUtil.Instance.ContentSearchResController != null) { AppDisplayUtil.Instance.ContentSearchResController.View.RemoveFromSuperview(); } AppDisplayUtil.Instance.ContentSearchResController = new ResultViewController(res); AppDisplayUtil.Instance.ContentSearchResController.View.TranslatesAutoresizingMaskIntoConstraints = false; ContainerView.AddSubview(AppDisplayUtil.Instance.ContentSearchResController.View); ContainerView.AddConstraints(new NSLayoutConstraint[] { NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0), NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0), NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Leading, 1, 0), NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Trailing, 1, 0) }); hud.Hide(animated: true, delay: 0.2); }
public void SearchContentTest_SPECIAL() { string keywords = "!@#$%^&*()_+}{|\\][\":?></.,;\'law"; Stopwatch time = new Stopwatch(); time.Start(); int bookID = 41; int tocID = 1074; List <ContentCategory> contentTypeList = new List <ContentCategory>(); var result = SearchUtil.Search(bookID, tocID, keywords); Assert.LessOrEqual(0, result.SearchDisplayResultList.Count); }
// Call to load from the XIB/NIB file public SearchResultsController(NSPopover popover, int bookID, int tocID, string keyword) : base("SearchResults", NSBundle.MainBundle) { parentPopover = popover; BookID = bookID; keyWord = keyword; List <ContentCategory> categoryList = new List <ContentCategory> (0); categoryList.Add(ContentCategory.All); AddTimer(); SearchResultsData = SearchUtil.Search(BookID, tocID, keyword, categoryList); Initialize(); }
public void ProcessContentSearchRequest(NSNotification obj) { string keyword = SearchBar.Text; SearchResult res = SearchUtil.Search(AppDataUtil.Instance.GetCurrentPublication().BookId, AppDataUtil.Instance.GetOpendTOC().ID, keyword); if (AppDisplayUtil.Instance.ContentSearchResController != null) { AppDisplayUtil.Instance.ContentSearchResController.View.RemoveFromSuperview(); } AppDisplayUtil.Instance.ContentSearchResController = new ResultViewController(res); AppDisplayUtil.Instance.ContentSearchResController.View.TranslatesAutoresizingMaskIntoConstraints = false; ContainerView.AddSubview(AppDisplayUtil.Instance.ContentSearchResController.View); ContainerView.AddConstraints(new NSLayoutConstraint[] { NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0), NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0), NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Leading, 1, 0), NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Trailing, 1, 0) }); }
public void SearchContentTest_MixType() { string keywords = "Supreme Court"; Stopwatch time = new Stopwatch(); time.Start(); int bookID = 41; int tocID = 8; List <ContentCategory> contentTypeList = new List <ContentCategory>(); contentTypeList.Clear(); contentTypeList.Add(ContentCategory.CommentaryType); contentTypeList.Add(ContentCategory.FormsPrecedentsType); var resultCommentaryType_FormsPrecedentsType = SearchUtil.Search(bookID, tocID, keywords, contentTypeList); Assert.LessOrEqual(0, resultCommentaryType_FormsPrecedentsType.SearchDisplayResultList.Count); contentTypeList.Clear(); contentTypeList.Add(ContentCategory.LegislationType); contentTypeList.Add(ContentCategory.FormsPrecedentsType); var resultLegislationType_FormsPrecedentsType = SearchUtil.Search(bookID, tocID, keywords, contentTypeList); Assert.LessOrEqual(0, resultLegislationType_FormsPrecedentsType.SearchDisplayResultList.Count); contentTypeList.Clear(); contentTypeList.Add(ContentCategory.LegislationType); contentTypeList.Add(ContentCategory.CommentaryType); var resultLegislationType_CommentaryType = SearchUtil.Search(bookID, tocID, keywords, contentTypeList); Assert.LessOrEqual(0, resultLegislationType_CommentaryType.SearchDisplayResultList.Count); contentTypeList.Clear(); contentTypeList.Add(ContentCategory.FormsPrecedentsType); contentTypeList.Add(ContentCategory.CommentaryType); contentTypeList.Add(ContentCategory.LegislationType); var result_ALL = SearchUtil.Search(bookID, tocID, keywords, contentTypeList); Assert.LessOrEqual(0, result_ALL.SearchDisplayResultList.Count); time.Stop(); Console.Out.WriteLine("Time : " + time.ElapsedMilliseconds); var tempText = keywords; }
public void SearchDocument(string keys) { var collection = SearchUtil.Search(Publication.BookId, CurrentTocNode.ID, keys); if (collection != null) { var foundWordList = collection.FoundWordList; SearchResultsAll = collection.SearchDisplayResultList.Select(result => new SearchResultModel { TocId = result.TocId, FirstLine = result.isDocument ? result.Head : result.TocTitle, SecondLine = result.isDocument ? result.SnippetContent : result.GuideCardTitle, ContentType = SearchResultFilter[(int)result.ContentType - 1], Type = result.isDocument ? ResourceLoader.GetString("Document") : ResourceLoader.GetString("Publication"), SnippetContent = result.SnippetContent, Keywords = foundWordList, HeadType = result.HeadType.ToString().ToLower(), HeadIndex = result.HeadSequence }).ToList <SearchResultModel>(); SearchTools.KeepKeyword(foundWordList); } SearchFilter = searchResultFilter[0]; }
public Task <IEnumerable <ISearchItem> > Search(string pattern, int page) { return(Task.FromResult(SearchUtil.Search(pattern, DataFolder, page))); }
partial void PopupButtonSelectChange(NSObject sender) { var button = (NSPopUpButton)sender; nint index = button.IndexOfSelectedItem; var rect = button.Frame; CGSize newSize; CGPoint newPoint = rect.Location; string keyword = keyWord; ContentCategory contentType = ContentCategory.All; nfloat height = rect.Height + 10; switch (index) { case 1: newSize = new CGSize(42, height); button.SetFrameSize(newSize); newPoint.X = 248; button.SetFrameOrigin(newPoint); contentType = ContentCategory.All; break; case 2: newSize = new CGSize(100, height); button.SetFrameSize(newSize); newPoint.X = 190; button.SetFrameOrigin(newPoint); contentType = ContentCategory.LegislationType; break; case 3: newSize = new CGSize(110, height); button.SetFrameSize(newSize); newPoint.X = 180; button.SetFrameOrigin(newPoint); contentType = ContentCategory.CommentaryType; break; case 4: newSize = new CGSize(158, height); button.SetFrameSize(newSize); newPoint.X = 132; button.SetFrameOrigin(newPoint); contentType = ContentCategory.FormsPrecedentsType; break; case 5: newSize = new CGSize(50, height); button.SetFrameSize(newSize); newPoint.X = 240; button.SetFrameOrigin(newPoint); contentType = ContentCategory.CaseType; break; } button.Title = button.TitleOfSelectedItem; List <ContentCategory> categoryList = new List <ContentCategory> (0); categoryList.Add(contentType); SearchResultsData = null; AddTimer(); SearchResultsData = SearchUtil.Search(BookID, tocID, keyword, categoryList); //Console.WriteLine ("search end:{0} SearchResultsData:{1}", NSDate.Now.ToString(), SearchResultsData); if (SearchResultsData != null && SearchResultsData.SearchDisplayResultList != null && SearchResultsData.SearchDisplayResultList.Count != 0) { ((SearchTableDataSource)SearchTableView.DataSource).SearchResults = SearchResultsData; ((SearchTableDelegate)SearchTableView.Delegate).SearchResults = SearchResultsData; SearchTableView.ReloadData(); SearchTableView.Hidden = false; NoResultLabel.Hidden = true; } else { SearchTableView.Hidden = true; NoResultLabel.Hidden = false; NoResultLabel.StringValue = "No search results found."; } RemoveLoadView(); }