From 16509c2eab31c64a41959dd7951edd04274462f3 Mon Sep 17 00:00:00 2001 From: Paul Larsen Date: Sun, 9 Feb 2025 22:44:01 -0500 Subject: [PATCH] B2025-011-Global-search-is-not-finding-question-marks --- .../Volian.Controls.Library/DisplaySearch.cs | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index cbe23ae4..ae1ef318 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -1699,6 +1699,8 @@ namespace Volian.Controls.Library else lbSrchResultsIncTrans.DisplayMember = _DisplayMember; if (_SearchResults != null) { + // record count flag + bool reccnt = true; // B2021-076: Proms search results are not presented in order when printed to PDF // B2023-041 - backed out previous change as it was not needed and was preventing the sorting of search results text if (cbSorted.Checked) @@ -1713,11 +1715,37 @@ namespace Volian.Controls.Library // B2021-076: Proms search results are not presented in order when printed to PDF var sortedResults = _SearchResults.OrderBy(x => x.SearchDefaultSort).ToList(); + // if searching for just a "?" remove all the special code matches and leaving only the true matches. + if (SearchString == "\\?") + { + string pat = @"\?"; + Regex r = new Regex(pat, RegexOptions.IgnoreCase); + for (int i = 0; i < sortedResults.Count; i++) + { + + Match m = r.Match(sortedResults[i].DisplayText); + if (m.Success) + { + continue; + } + else + { + sortedResults.Remove(sortedResults[i]); + + i--; + } + } + grpPanSearchResults.Text = string.Format("Search Results Found: {0}", sortedResults.Count); + reccnt = false; + } + if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) lbSrchResults.DataSource = sortedResults; else lbSrchResultsIncTrans.DataSource = sortedResults; } - - grpPanSearchResults.Text = string.Format("Search Results Found: {0}", _SearchResults.Count); + if (reccnt) + { + grpPanSearchResults.Text = string.Format("Search Results Found: {0}", _SearchResults.Count); + } grpPanSearchResults.Style.BackColor = Color.LightGreen;// Color.YellowGreen; Color.DarkSeaGreen; } else @@ -2076,6 +2104,7 @@ namespace Volian.Controls.Library //TypesSelected = (typstr != null) ? "Searched Step Types: " + typstr : "Searched All Step Types"; //TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "All Step Types"); SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString /*.Replace(@"\",@"\u9586?")*/, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, byWordPrefix, byWordSuffix); + cmbResultsStyleIndex = 3; // display step text in results //} } -- 2.47.2