Skip to content

Commit 33f3b51

Browse files
committed
Removed "-v9" and added "-v8" to v9/V8 articles
1 parent 55481c7 commit 33f3b51

File tree

18 files changed

+853
-853
lines changed

18 files changed

+853
-853
lines changed

Extending/Backoffice-Search/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,4 @@ public class CustomUmbracoTreeSearcherFields : UmbracoTreeSearcherFields,    
9797

9898
## More advanced extensions
9999

100-
For further extensibility of the Umbraco Backoffice search implementation check [ISearchableTree](../Section-Trees/Searchable-Trees/index-v9.md "https://our.umbraco.com/Documentation/Extending/Section-Trees/Searchable-Trees/index-v9.md")
100+
For further extensibility of the Umbraco Backoffice search implementation check [ISearchableTree](../Section-Trees/Searchable-Trees/index.md "https://our.umbraco.com/Documentation/Extending/Section-Trees/Searchable-Trees/index.md")

Extending/FileSystemProviders/Azure-Blob-Storage/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
versionFrom: 8.0.0
3+
needsV9Update: "true"
34
---
45

56
# Setup Your Site to use Azure Blob Storage for Media and Image Processor Cache

Extending/Packages/Creating-a-Package/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ We will leave the `Package options view` selector empty, but in case you were wo
7373

7474
### Package Actions section
7575

76-
Here, you can add package actions. There are a number of [default package actions](../Package-Actions/index-v9.md) and you can also create your own [custom package actions](../Package-Actions/custom-package-actions.md)
76+
Here, you can add package actions. There are a number of [default package actions](../Package-Actions/index.md) and you can also create your own [custom package actions](../Package-Actions/custom-package-actions.md)
7777

7878
Finally, after filling out all the information we can select **Create** to create the package. We will download it, in order to take a closer look at what it contains in the generated zip file.
7979

Extending/Property-Editors/Build-a-Block-Editor.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace MyNamespace
6666

6767
Notice how the `PropertyEditorAsset` attribute is used to load the `UnicornBlocks.controller.js` JavaScript file.
6868

69-
Your Property Editor will need a `PropertyValueConverter`. Read more about [Property Value Converters](value-converters-v9.md).
69+
Your Property Editor will need a `PropertyValueConverter`. Read more about [Property Value Converters](value-converters.md).
7070

7171
## Data structure of Block Editors
7272

Extending/Property-Editors/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ verified-against: alpha-3
55
versionFrom: 9.0.0
66
meta.Title: "Umbraco Property Editors"
77
meta.Description: "Guide on how to work with and create Property Editors in Umbraco"
8-
needsv9Update: "true"
98
---
109

1110

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
versionFrom: 8.0.0
3+
---
4+
5+
# Searchable Trees (ISearchableTree)
6+
7+
When you type a search term into the Umbraco backoffice search field, you'll see search results from all the Section Trees that your user account has permissions to access:
8+
9+
![Content Section Dashboards](images/backoffice-search-v8.png)
10+
11+
The results are grouped by 'Section Tree' e.g. Content, Media, Document Types: essentially, each 'Tree' has its own associated search mechanism that receives the search term and looks for matches in the tree that is responsible for searching.
12+
13+
You can create your own search mechanisms for your own custom sections or replace the default search implementation for a particular section tree.
14+
15+
## Custom Tree Search
16+
17+
To create a search for your own custom tree you need to create a C# class that implements the interface `Umbraco.Web.Search.ISearchableTree`.
18+
19+
### ISearchableTree
20+
21+
```csharp
22+
public interface ISearchableTree
23+
{
24+
//
25+
// Summary:
26+
// The alias of the tree that the Umbraco.Web.Search.ISearchableTree belongs to
27+
string TreeAlias { get; }
28+
29+
//
30+
// Summary:
31+
// Searches for results based on the entity type
32+
// Parameters:
33+
// query:
34+
// pageSize:
35+
// pageIndex:
36+
// totalFound:
37+
// searchFrom:
38+
// A starting point for the search, generally a node id, but for members this is
39+
// a member type alias
40+
IEnumerable<SearchResultEntity> Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null);
41+
}
42+
```
43+
44+
Your implementation needs to return an IEnumerable of `SearchResultEntity` items:
45+
46+
```csharp
47+
public class SearchResultEntity : EntityBasic
48+
{
49+
public SearchResultEntity();
50+
51+
//
52+
// Summary:
53+
// The score of the search result
54+
[System.Runtime.Serialization.DataMemberAttribute(Name = "score")]
55+
public float Score { get; set; }
56+
}
57+
```
58+
59+
A `SearchResultEntity` consists of a Score (a Float value) identifying its relevance to the search term, and the set of `EntityBasic` properties that all Umbraco objects share: eg Name, Id, Udi, Icon, Trashed, Key, ParentId, Path, Alias, AdditionalData.
60+
61+
#### Example implementation of ISearchableTree
62+
63+
If we have a custom section Tree with alias 'favouriteThingsAlias' (see the [custom tree example](../trees-v7.md)) then we could implement searchability by creating the following c# class in our site:
64+
65+
```csharp
66+
public class FavouriteThingsSearchableTree : ISearchableTree
67+
{
68+
public string TreeAlias => "favouriteThingsAlias";
69+
70+
public IEnumerable<SearchResultEntity> Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null)
71+
{
72+
// your custom search implementation starts here
73+
Dictionary<int, string> favouriteThings = new Dictionary<int, string>();
74+
favouriteThings.Add(1, "Raindrops on Roses");
75+
favouriteThings.Add(2, "Whiskers on Kittens");
76+
favouriteThings.Add(3, "Skys full of Stars");
77+
favouriteThings.Add(4, "Warm Woolen Mittens");
78+
favouriteThings.Add(5, "Cream coloured Unicorns");
79+
favouriteThings.Add(6, "Schnitzel with Noodles");
80+
81+
var searchResults = new List<SearchResultEntity>();
82+
83+
var matchingItems = favouriteThings.Where(f => f.Value.StartsWith(query, true, System.Globalization.CultureInfo.CurrentCulture));
84+
foreach (var matchingItem in matchingItems)
85+
{
86+
// making up the Id/Udi for this example! - these would normally be different for each search result.
87+
searchResults.Add(new SearchResultEntity() { Id = 12345, Alias = "favouriteThingItem", Icon = "icon-favorite", Key = new Guid("325746a0-ec1e-44e8-8f7b-6e7c4aab36d1"), Name = matchingItem.Value, ParentId = -1, Path = "-1,123456", Score = 1.0F, Trashed = false, Udi = Udi.Create("document", new Guid("325746a0-ec1e-44e8-8f7b-6e7c4aab36d1")) });
88+
}
89+
// set number of search results found
90+
totalFound = matchingItems.Count();
91+
// return your IEnumerable of SearchResultEntity
92+
return searchResults;
93+
}
94+
}
95+
```
96+
97+
That's all we need, after an application pool recycle, if we now search in the backoffice we'll see matches from our custom 'Favourite Things' tree:
98+
99+
![Content Section Dashboards](images/favouritethings-search-v8.png)
100+
101+
Umbraco automatically finds any implementation of ISearchableTree in your site, and automatically configures it to be used for the custom section mentioned in the TreeAlias property. Be careful not to accidentally have two ISearchableTree implementations trying to search the 'same' TreeAlias, it's *one* ISearchableTree per TreeAlias!
102+
103+
## Replacing an existing Section Tree Search (SearchableTreeResolver)
104+
105+
Perhaps you want to change the logic for searching an existing section of the site, (why? - well you might have a 'company name' property on a MemberType in the Member section, and you want searches for that company name to filter the members who work there, the default implementation will only search on Member Name)
106+
107+
Or perhaps you want to replace Examine search in the backoffice with an external Search Service, e.g. Azure Search. In a cloud hosted implementation you don't need to build the Examine indexes on each new server as your cloud hosting scales out.
108+
109+
### Example
110+
111+
First create your replacement custom `ISearchableTree` implementation, using the same approach as above, but specifying the TreeAlias of the Tree you aim to replace, e.g. 'Member'
112+
113+
```csharp
114+
public string TreeAlias => "member";
115+
```
116+
To avoid your custom implementation clashing with the default `ISearchableTree` for a Tree, you need to remove its `ISearchableTree` implementation from the collection of SearchableTrees using an IUserComposer when Umbraco starts up:
117+
118+
```csharp
119+
using Umbraco.Core.Components;
120+
using Umbraco.Web;
121+
122+
namespace My.Website
123+
{
124+
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
125+
public class RemoveCoreMemberSearchableTreeComposer : IUserComposer
126+
{
127+
public void Compose(Composition composition)
128+
{
129+
//Remove core MemberTreeController
130+
composition.SearchableTrees().Exclude<MemberTreeController>();
131+
}
132+
}
133+
}
134+
```
135+
136+
This would then allow your custom implementation of ISearchableTree with TreeAlias 'Member' to be used when searching the Member Section Tree.

Extending/Section-Trees/Searchable-Trees/index-v9.md

-146
This file was deleted.

0 commit comments

Comments
 (0)