Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions BlueprintExplorer/BlueprintDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -962,10 +962,13 @@ public List<BlueprintHandle> SearchBlueprints(string searchText, int matchBuffer

List<string> passThrough = searchText.Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList();

string groupBy = null;

for (int i = 0; i < passThrough.Count; i++)
{
var special = passThrough[i][1..];
bool remove = true;

switch (passThrough[i][0])
{
case '?':
Expand All @@ -985,6 +988,11 @@ public List<BlueprintHandle> SearchBlueprints(string searchText, int matchBuffer
//toSearch = toSearch.Where(b => EntryIsNotNull(b, path)).ToList();
}
break;
case '>':
groupBy = special;

toSearch = toSearch.Where(b => b.EnsureObj.Str(special) is not null).ToList();
break;
default:
remove = false;
break;
Expand All @@ -1010,7 +1018,12 @@ public List<BlueprintHandle> SearchBlueprints(string searchText, int matchBuffer
results.Add(handle);
cancellationToken.ThrowIfCancellationRequested();
}

results.Sort((x, y) => y.Score(matchBuffer).CompareTo(x.Score(matchBuffer)));

if (groupBy is not null)
return results.GroupBy(handle => handle.EnsureObj.Str(groupBy)).SelectMany(group => group).ToList();

return results;
}

Expand Down
Loading