Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 15/umbraco-ui-builder/searching/overview.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
description: Configuring searching in Umbraco UI Builder, the backoffice UI builder for Umbraco.
description: Configure search functionality in Umbraco UI Builder.
---

# Searching

Beyond listing collection entities, if you need to be able to locate specific entities within a collection then Umbraco UI Builder provides a search API.
Umbraco UI Builder includes a search API for filtering and locating specific entities within a collection. This enhances usability, especially in collections with large datasets.

![Search](../images/search.png)

Expand Down
32 changes: 21 additions & 11 deletions 15/umbraco-ui-builder/searching/searchable-properties.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,44 @@
---
description: Configuring searchable properties in Umbraco UI Builder, the backoffice UI builder for Umbraco.
description: Configure searchable properties in Umbraco UI Builder.
---

# Searchable Properties

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.
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.

You can also use any `String` based property of nested objects of a model, as long as the parent object is not null.
Both direct `String` properties and `String` properties within nested objects can be made searchable, provided the parent object is not `null`.

![Search](../images/search.png)

## Defining searchable properties
## Defining Searchable Properties

### **AddSearchableProperty(Lambda searchablePropertyExpression) : CollectionConfigBuilder<TEntityType>**
### Using `AddSearchableProperty()` Method

Adds the given property to the searchable properties collection.
Use `AddSearchableProperty` to specify which properties should be included in search functionality.

````csharp
// Example
#### Method Syntax

```cs
AddSearchableProperty(Lambda searchablePropertyExpression) : CollectionConfigBuilder<TEntityType>
```

#### Example

````cs
collectionConfig.AddSearchableProperty(p => p.FirstName);
collectionConfig.AddSearchableProperty(p => p.Address.Street);
````

## Search Expression Pattern

Up to version 15.0.1, the search was performed using the `StartsWith` method call.
From 15.0.1 and up, search operations can be performed using the `Contains` method call.
The search behavior differs based on the version:

- Up to version 15.0.1: Search uses the `StartsWith` method, meaning results include entries that begin with the search term.
- 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.

### Example

````csharp
// Example
collectionConfig.AddSearchableProperty(p => p.FirstName); // will search for keywords that start with.
collectionConfig.AddSearchableProperty(p => p.FirstName, )SearchExpressionPattern.Contains); // will search for keywords that are contained.
````