protected override bool PerformSearch(string query, bool isQuick) { DateTime start = DateTime.Now; PXEntitySearch search = new PXEntitySearch(); List<PXSearchResult> searchResults = new List<PXSearchResult>(); Search.NavigationHandler = delegate(string args) { return NavHandler(args, searchResults); }; search.IgnoreCache = Search.CurrentPage == 0 ? true : false; searchResults.AddRange(search.Search(query, Search.CurrentPage * 20, 20)); if (searchResults.Count == 0) { Search.DisplaySearchTips(query, SearchTips); return false; } int i = Search.CurrentPage * 20; Search.MaxDescriptionColumns = search.MaxDescriptionColumns; foreach (PXEntitySearch.Result res in searchResults) { Search.DisplayResult(res); i++; } TimeSpan span = DateTime.Now.Subtract(start); Search.DisplayResult(PXMessages.LocalizeFormatNoPrefix(Messages.SearchResultsShort, HttpUtility.HtmlEncode(query), this.ctrlSearch.FormatTimeResult(span))); Search.PagesCount = search.TotalCount % 20 == 0 ? search.TotalCount / 20 : search.TotalCount / 20 + 1; Search.PagerHasPrev = search.HasPrevPage; Search.PagerHasNext = search.HasNextPage; return true; }
protected override bool PerformSearch(string query, bool isQuick) { DateTime start = DateTime.Now; PXEntitySearch search = new PXEntitySearch(); List <PXSearchResult> searchResults = new List <PXSearchResult>(); Search.NavigationHandler = delegate(string args) { return(NavHandler(args, searchResults)); }; search.IgnoreCache = Search.CurrentPage == 0 ? true : false; searchResults.AddRange(search.Search(query, Search.CurrentPage * 20, 20)); if (searchResults.Count == 0) { Search.DisplaySearchTips(query, SearchTips); return(false); } int i = Search.CurrentPage * 20; Search.MaxDescriptionColumns = search.MaxDescriptionColumns; foreach (PXEntitySearch.Result res in searchResults) { Search.DisplayResult(res); i++; } TimeSpan span = DateTime.Now.Subtract(start); Search.DisplayResult(PXMessages.LocalizeFormatNoPrefix(Messages.SearchResultsShort, HttpUtility.HtmlEncode(query), this.ctrlSearch.FormatTimeResult(span))); Search.PagesCount = search.TotalCount % 20 == 0 ? search.TotalCount / 20 : search.TotalCount / 20 + 1; Search.PagerHasPrev = search.HasPrevPage; Search.PagerHasNext = search.HasNextPage; return(true); }
protected bool PerformSearchEntity(string query, int page) { Debug.Print("PerformSearch: {0}", query); Stopwatch sw = new Stopwatch(); sw.Start(); DateTime start = DateTime.Now; PXEntitySearch search = new PXEntitySearch(); search.Category = GetCategory(); if (!search.IsFullText()) { ShowFullTextWarning(); } List <EntitySearchResult> searchResults = search.Search(query, page, 10); if (searchResults.Count == 0) { if (!search.IsSearchIndexExists()) { DisplayIndexTips(); } else { DisplaySearchTips(query); } return(false); } RenderResultsEntity(searchResults); linkPrev.Visible = search.HasPrevPage; linkNext.Visible = search.HasNextPage; StorePages(-search.PreviousIndex, search.NextIndex); sw.Stop(); Debug.Print("PerformSearch Completed in {0} millisec.", sw.ElapsedMilliseconds); return(true); }