Setting SearchExpressionPattern in Umbraco UI Builder

I posted this on discord so I thought I would copy it over and test my question here on the forums.

I’m working on setting up a searchable property in Umbraco UI Builder in Umbraco 14 and I know that the default is StartsWith - however, the recent versions have the ability to set how to use the search.

I can see that this was resolved in this issue on GitHub:

The documentation here theoretically shows how to do it:

I can also confirm I am on a compatible version of Umbraco UI Builder (14.0.3) and I can access SearchExpressionPattern so theoretically this should all “just work”…

However, there’s clearly an error in the documentation because there’s an extra parenthesis in the middle of the statement, which is invalid. If I cut that out and try it like this it tells me no overload .AddSearchableProperty() takes two parameters.

What I assume the documentation should look like but doesn’t work:

collectionConfig.AddSearchableProperty(p => p.FirstName, SearchExpressionPattern.Contains);

Has anyone done this and knows the actual syntax for using SearchExpressionPattern.Contains? Am I missing something obvious? :rofl:

Example that doesn’t work is in my screenshot:

Based on the conversation in Discord with Jemayn, I feel this is a bug in Umbraco UI Builder and I have reported it:

1 Like