V8: Always show content and media search results first (#5309)

This commit is contained in:
Kenn Jacobsen
2019-05-31 20:29:00 +02:00
committed by Sebastiaan Janssen
parent 342f924e8f
commit 30067d92ae
6 changed files with 35 additions and 10 deletions

View File

@@ -153,22 +153,20 @@ namespace Umbraco.Web.Editors
var allowedSections = Security.CurrentUser.AllowedSections.ToArray();
foreach (var searchableTree in _searchableTreeCollection.SearchableApplicationTrees)
foreach (var searchableTree in _searchableTreeCollection.SearchableApplicationTrees.OrderBy(t => t.Value.SortOrder))
{
if (allowedSections.Contains(searchableTree.Value.AppAlias))
{
var tree = _treeService.GetByAlias(searchableTree.Key);
if (tree == null) continue; //shouldn't occur
var searchableTreeAttribute = searchableTree.Value.SearchableTree.GetType().GetCustomAttribute<SearchableTreeAttribute>(false);
result[Tree.GetRootNodeDisplayName(tree, Services.TextService)] = new TreeSearchResult
{
Results = searchableTree.Value.SearchableTree.Search(query, 200, 0, out var total),
TreeAlias = searchableTree.Key,
AppAlias = searchableTree.Value.AppAlias,
JsFormatterService = searchableTreeAttribute == null ? "" : searchableTreeAttribute.ServiceName,
JsFormatterMethod = searchableTreeAttribute == null ? "" : searchableTreeAttribute.MethodName
JsFormatterService = searchableTree.Value.FormatterService,
JsFormatterMethod = searchableTree.Value.FormatterMethod
};
}
}