C2020-009 Search By Word

This commit is contained in:
2020-05-04 14:09:48 +00:00
parent 8601061eef
commit 6f42f911f7
5 changed files with 1045 additions and 248 deletions

View File

@@ -1391,7 +1391,7 @@ namespace Volian.Controls.Library
ReportTitle = "Step Element Report"; //"Proms - Search by Type: " + typstr;
TypesSelected = "Filtered By: " + typstr;
SearchString = null;
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, "", cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, ItemSearchIncludeLinks.Value, includeRTFformat, includeSpecialChars, unitPrefix);
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, "", cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, ItemSearchIncludeLinks.Value, includeRTFformat, includeSpecialChars, unitPrefix,"","");
cmbResultsStyleIndex = 1; //display step locations in results
}
}
@@ -1406,10 +1406,38 @@ namespace Volian.Controls.Library
//{
//ReportTitle = string.Format("Proms - {0} Search for '{1}'", cbxBooleanTxtSrch.Checked ? "Boolean" : "Text", TextSearchString);
ReportTitle = string.Format("Search for '{0}'", TextSearchString);
// C2020-009: Search - Allow search 'By Word'.
string byWordPrefix = "";
string byWordSuffix = "";
if (cbxByWord.Checked)
{
// Generate a prefix & suffix to be used in the sql query around the search string.
// If the search string starts (prefix)/ends(suffix) with a number, then use an expression that
// does not allow the preceding/following text to have a number, '.', letter or other rtf
// commands. If the search string starts/ends with a letter, then use an expression that does not
// find the preceding/following text that is text, i.e. a letter.
if (Regex.IsMatch(TextSearchString, @"^[\d\.]")) // starts with a number or '.' decimal pt
{
byWordPrefix = @"[^0-9a-zA-Z.vbpi:\\-]";
}
else if (Regex.IsMatch(TextSearchString, @"^[a-zA-Z]")) // starts with a letter
{
byWordPrefix = @"[^a-zA-Z]";
}
if (Regex.IsMatch(TextSearchString, @"[\d\.]$")) // ends with a number or decimal
{
byWordSuffix = @"[^0-9a-zA-Z.vbpi:\\-]";
}
else if (Regex.IsMatch(TextSearchString, @"[a-zA-Z]$")) // ends with a letter
{
byWordSuffix = @"[^a-zA-Z]";
}
}
SearchString = TextSearchString;
//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);
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
//}
}
@@ -1445,7 +1473,7 @@ namespace Volian.Controls.Library
//TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "All Step Types");
if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked)
{
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix);
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, "", "");
cmbResultsStyleIndex = 3; // display step text in results
}
else