> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-cms/19.latest/develop-with-umbraco/search/extending-search/index-values-for-property-editors.md).

# Index Values: Property Editors

How to provide index values for search, and how to replace the built-in values

In the world of search, a full-text searchable string behaves a lot differently than a keyword for filtering. Integer and decimal values also have their own special traits, and dates add yet another layer of complexity.

To understand the intent of the Umbraco property editor values, search uses a concept called *property value handlers*.

## The property value handler

A property value handler for search is analogous to a property value converter for rendering. With one crucial exception: If a property editor does *not* supply a property value handler, properties of that type will be skipped when indexing.

If you have built a custom property editor that should supply index values, you must create a property value handler for it.

The property value handler is created by implementing the `IPropertyValueHandler` interface:

{% code title="MyPropertyEditorPropertyValueHandler.cs" %}

```csharp
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Search.Indexing;

namespace My.Site.PropertyValueHandlers;

public class MyPropertyEditorPropertyValueHandler : IPropertyValueHandler
{
    public bool CanHandle(IPropertyType propertyType)
        => propertyType.PropertyEditorAlias is "My.PropertyEditor";

    public IEnumerable<IndexField> GetIndexFields(
        IProperty property,
        string? culture,
        string? segment,
        bool published,
        IContentBase contentContext)
        => property.GetValue(culture, segment, published) is string { Length: > 0 } value
            ? [
                new IndexField(
                    property.Alias,
                    new IndexValue
                    {
                        // Index the value as a text for full text search.
                        Texts = [value]
                    },
                    culture,
                    segment)
            ]
            : [];
}
```

{% endcode %}

{% hint style="info" %}
The property value handler can produce multiple index fields. Each index field can contain any combination of data in its index value.
{% endhint %}

For example, a complex property editor might yield an index value with data in both the `Texts` and `Integers` collections.

{% hint style="info" %}
Property value handlers are automatically detected, so you do not need to register them explicitly.
{% endhint %}

## Replacing the default property value handlers

[This list](/umbraco-cms/19.latest/develop-with-umbraco/search/built-in-property-editors.md) shows how the default Umbraco property editors transform their values to index data.

You can change this by replacing the default property value handlers you require to work differently.

The following example makes the radio button list produce *both* searchable `Texts` *and* `Keywords` for filtering and faceting:

{% code title="MyRadioButtonListPropertyValueHandler.cs" %}

```csharp
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Search.Indexing;

namespace My.Site.PropertyValueHandlers;

public class MyRadioButtonListPropertyValueHandler : IPropertyValueHandler
{
    public bool CanHandle(IPropertyType propertyType)
        => propertyType.PropertyEditorAlias is Umbraco.Cms.Core.Constants.PropertyEditors.Aliases.RadioButtonList;

    public IEnumerable<IndexField> GetIndexFields(
        IProperty property,
        string? culture,
        string? segment,
        bool published,
        IContentBase contentContext)
        => property.GetValue(culture, segment, published) is string { Length: > 0 } value
            ? [
                new IndexField(
                    property.Alias,
                    new IndexValue
                    {
                        // Index the value as both keyword for filtering and as text for full text search.
                        Keywords = [value],
                        Texts = [value],
                    },
                    culture,
                    segment)
            ]
            : [];
}
```

{% endcode %}

## Property value handler results are cached

The property value handlers are invoked when the [content indexers](/umbraco-cms/19.latest/develop-with-umbraco/search/extending-search/gathering-data-with-content-indexers.md) gather content. This means their values are cached at indexing time, for re-use when rebuilding an index.

Effectively, this means any changes to property value handlers won't be reflected in an index rebuild. Only explicit reindexing of single content items will trigger content gathering again.

You can read more about the index value cache and how to work with it in [the Database Cache for Index Values article](/umbraco-cms/19.latest/develop-with-umbraco/search/extending-search/database-cache-for-index-values.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/umbraco-cms/19.latest/develop-with-umbraco/search/extending-search/index-values-for-property-editors.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
