Support localization for content search (backoffice) (#12618)

* Support localization for content search

* Formatting

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>

* Review changes

* Review changes

Co-authored-by: kjac <kjn@impact.dk>
Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
This commit is contained in:
Kenn Jacobsen
2022-07-04 13:45:33 +02:00
committed by GitHub
parent 173c1c8c8f
commit f2a98309b4
3 changed files with 38 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ namespace Umbraco.Cms.Web.BackOffice.Trees
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
[CoreTree]
[SearchableTree("searchResultFormatter", "configureContentResult", 10)]
public class ContentTreeController : ContentTreeControllerBase, ISearchableTree
public class ContentTreeController : ContentTreeControllerBase, ISearchableTreeWithCulture
{
private readonly UmbracoTreeSearcher _treeSearcher;
private readonly ActionCollection _actions;
@@ -369,8 +369,11 @@ namespace Umbraco.Cms.Web.BackOffice.Trees
}
public async Task<EntitySearchResults> SearchAsync(string query, int pageSize, long pageIndex, string? searchFrom = null)
=> await SearchAsync(query, pageSize, pageIndex, searchFrom, null);
public async Task<EntitySearchResults> SearchAsync(string query, int pageSize, long pageIndex, string? searchFrom = null, string? culture = null)
{
var results = _treeSearcher.ExamineSearch(query, UmbracoEntityTypes.Document, pageSize, pageIndex, out long totalFound, searchFrom);
var results = _treeSearcher.ExamineSearch(query, UmbracoEntityTypes.Document, pageSize, pageIndex, out long totalFound, culture: culture, searchFrom: searchFrom);
return new EntitySearchResults(results, totalFound);
}
}