The search facility of the Umbraco Backoffice allows the searching 'across sections' of different types of Umbraco entities, for example Content, Media, Members. However 'by default' only a small subset of standard fields are searched:
An Umbraco implementation might have additional custom properties that it would be useful to include in a Backoffice Search. For example: an 'Organisation Name' property on a Member Type, or a 'Product Code' field for a 'Product' content item.
Adding custom properties to backoffice search
To add custom properties, it is required to register a custom implementation of IUmbracoTreeSearcherFields. We recommend to override the existing UmbracoTreeSearcherFields.
Your custom implementation needs to be registered in the container. For example in the Program.cs file or in a composer, as an alternative.
The below example is using ILocalizationService which is currently obselete and will be removed in v15. Use ILanguageService instead.
usingSystem.Collections.Generic;usingUmbraco.Cms.Core.Services;usingUmbraco.Cms.Infrastructure.Examine;usingUmbraco.Cms.Infrastructure.Search;namespaceUmbraco.Docs.Samples.Web.BackofficeSearch;publicclassCustomUmbracoTreeSearcherFields:UmbracoTreeSearcherFields,IUmbracoTreeSearcherFields{publicCustomUmbracoTreeSearcherFields(ILocalizationService localizationService) : base(localizationService) { } //Adding custom field to search in all nodespublicnewIEnumerable<string> GetBackOfficeFields() {returnnewList<string>(base.GetBackOfficeFields()) { "nodeType" }; } //Adding custom field to search in document typespublicnewIEnumerable<string> GetBackOfficeDocumentFields() {returnnewList<string>(base.GetBackOfficeDocumentFields()) { "nodeType" }; } //Adding custom field to search in mediapublicnewIEnumerable<string> GetBackOfficeMediaFields() {returnnewList<string>(base.GetBackOfficeMediaFields()) { "nodeType" }; } //Adding custom field to search in memberspublicnewIEnumerable<string> GetBackOfficeMembersFields() {returnnewList<string>(base.GetBackOfficeMembersFields()) { "nodeType" }; }}
You cannot use this to search on integer types in the index, as an example parentID does not work.
More advanced extensions
For further extensibility of the Umbraco Backoffice search implementation check ISearchableTree