Skip to content

Commit

Permalink
fix Search Any Where filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Sep 17, 2023
1 parent 602754d commit 8d71a6a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10,959 deletions.
9 changes: 5 additions & 4 deletions Analogy.Common/DataTypes/FilterCriteriaObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class FilterCriteriaObject
public DateTime EndTime { get; set; }

private AnalogyLogLevel[] _arrLevels;
public AnalogyLogLevel[] Levels
public AnalogyLogLevel[]? Levels
{
get => _arrLevels;
set => _arrLevels = value;
Expand Down Expand Up @@ -249,9 +249,10 @@ IEnumerable<string> GenerateSingleCombinationPerColumn(string field, bool numeri

if (SearchEveryWhere)
{
var entries = Columns.Select(c =>
string.Join(orOperationInInclude ? " Or " : " and ",
GenerateSingleCombinationPerColumn(c.Field, c.Numerical)));
var allValidCombinations =
Columns.Select(c => GenerateSingleCombinationPerColumn(c.Field, c.Numerical).ToList());
var entries = allValidCombinations.Where(c=>c.Any()).Select(c =>
string.Join(orOperationInInclude ? " Or " : " and ", c));
var combined = string.Join(" Or ", entries);
return combined;
}
Expand Down
26 changes: 2 additions & 24 deletions Analogy.CommonControls/UserControls/LogMessagesUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2153,26 +2153,6 @@ public void FilterResults(string module)

private void FilterResults()
{
if (txtbInclude.Text == txtbInclude.Properties.NullText)
{
SetTextIfDifferent(txtbInclude, null);
}

if (txtbExclude.Text == txtbExclude.Properties.NullText)
{
SetTextIfDifferent(txtbExclude, null);
}

if (txtbSource.Text == txtbSource.Properties.NullText)
{
SetTextIfDifferent(txtbSource, null);
}

if (txtbModule.Text == txtbModule.Properties.NullText)
{
SetTextIfDifferent(txtbModule, null);
}

string include = txtbInclude.EditValue == null ? string.Empty : txtbInclude.EditValue.ToString().Trim();
string exclude = txtbExclude.EditValue == null ? string.Empty : txtbExclude.EditValue.ToString().Trim();
if (!autoCompleteInclude.Contains(include))
Expand All @@ -2189,10 +2169,8 @@ private void FilterResults()
Settings.AddNewSearchesEntryToLists(exclude, false);
_filterCriteria.StartTime = ceNewerThanFilter.Checked ? deNewerThanFilter.DateTime : DateTime.MinValue;
_filterCriteria.EndTime = ceOlderThanFilter.Checked ? deOlderThanFilter.DateTime : DateTime.MaxValue;
_filterCriteria.TextInclude = ceIncludeText.Checked ? (txtbInclude.EditValue == null ? string.Empty : txtbInclude.EditValue.ToString().Trim()) : string.Empty;
_filterCriteria.TextExclude = ceExcludeText.Checked
? (txtbExclude.EditValue == null ? string.Empty : txtbExclude.EditValue.ToString().Trim()) + string.Join("|", _excludeMostCommon)
: string.Empty;
_filterCriteria.TextInclude = ceIncludeText.Checked ? include : string.Empty;
_filterCriteria.TextExclude = ceExcludeText.Checked ? exclude + string.Join("|", _excludeMostCommon) : string.Empty;

_filterCriteria.Levels = null;
switch (LogLevelSelectionType)
Expand Down
Loading

0 comments on commit 8d71a6a

Please sign in to comment.