|
1 | 1 | --- |
2 | | -description: Configuring searchable properties in Umbraco UI Builder, the backoffice UI builder for Umbraco. |
| 2 | +description: Configure searchable properties in Umbraco UI Builder. |
3 | 3 | --- |
4 | 4 |
|
5 | 5 | # Searchable Properties |
6 | 6 |
|
7 | | -Searchable properties allow you to define any `String` based properties on a model. They will be searchable via Umbraco UI Builder's list view and entity picker search controls. |
| 7 | +Searchable properties allow you to define any `String` based properties in a model. It can be searched via Umbraco UI Builder's list view and entity picker search controls. |
8 | 8 |
|
9 | | -You can also use any `String` based property of nested objects of a model, as long as the parent object is not null. |
| 9 | +Both direct `String` properties and `String` properties within nested objects can be made searchable, provided the parent object is not `null`. |
10 | 10 |
|
11 | 11 |  |
12 | 12 |
|
13 | | -## Defining searchable properties |
| 13 | +## Defining Searchable Properties |
14 | 14 |
|
15 | | -### **AddSearchableProperty(Lambda searchablePropertyExpression) : CollectionConfigBuilder<TEntityType>** |
| 15 | +### Using `AddSearchableProperty()` Method |
16 | 16 |
|
17 | | -Adds the given property to the searchable properties collection. |
| 17 | +Use `AddSearchableProperty` to specify which properties should be included in search functionality. |
18 | 18 |
|
19 | | -````csharp |
20 | | -// Example |
| 19 | +#### Method Syntax |
| 20 | + |
| 21 | +```cs |
| 22 | +AddSearchableProperty(Lambda searchablePropertyExpression) : CollectionConfigBuilder<TEntityType> |
| 23 | +``` |
| 24 | + |
| 25 | +#### Example |
| 26 | + |
| 27 | +````cs |
21 | 28 | collectionConfig.AddSearchableProperty(p => p.FirstName); |
22 | 29 | collectionConfig.AddSearchableProperty(p => p.Address.Street); |
23 | 30 | ```` |
24 | 31 |
|
25 | 32 | ## Search Expression Pattern |
26 | 33 |
|
27 | | -Up to version 15.0.1, the search was performed using the `StartsWith` method call. |
28 | | -From 15.0.1 and up, search operations can be performed using the `Contains` method call. |
| 34 | +The search behavior differs based on the version: |
| 35 | + |
| 36 | +- Up to version 15.0.1: Search uses the `StartsWith` method, meaning results include entries that begin with the search term. |
| 37 | +- Version 15.0.1 and later: Search can be configured to use `Contains`, allowing results that include the search term anywhere within the property value. |
| 38 | + |
| 39 | +### Example |
29 | 40 |
|
30 | 41 | ````csharp |
31 | | -// Example |
32 | 42 | collectionConfig.AddSearchableProperty(p => p.FirstName); // will search for keywords that start with. |
33 | 43 | collectionConfig.AddSearchableProperty(p => p.FirstName, )SearchExpressionPattern.Contains); // will search for keywords that are contained. |
34 | 44 | ```` |
0 commit comments