Setting SearchExpressionPattern in Umbraco UI Buil...
# help-with-umbraco
j
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: https://github.com/umbraco/Umbraco.UIBuilder.Issues/issues/116 The documentation here theoretically shows how to do it: https://docs.umbraco.com/umbraco-ui-builder/14.latest/searching/searchable-properties#search-expression-pattern 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:
Copy code
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? Example that doesn't work is in my screenshot https://cdn.discordapp.com/attachments/1337165954131693609/1337165954366570547/image.png?ex=67a67456&is=67a522d6&hm=0fc0817ba08397907d9fa32f8476cadc86bc199b966c8dab6a205ff5402e29fa&
j
Using UI builder v13.1.7 this works:
.AddSearchableProperty(x => x.Name, SearchExpressionPattern.Contains)
And when stepping into the
AddSearchableProperty
Rider tells me there are two versions of it: Are you sure that it actually is added in 14.0.3? Could be a case of it only being in the latest 13 and latest 15 versions? https://cdn.discordapp.com/attachments/1337165954131693609/1337338702573080596/image.png?ex=67a71539&is=67a5c3b9&hm=c7fe9cba70e9cff04ea277e869f5de97291ec131d4dea64e1df5736962b30d05&
j
Thanks, Jemayn! I believe it’s been added to the 14.0.1 release based on the tags in my screenshot. Also it’s in the v14 documentation. So if it’s not actually in v14 then that’s really confusing and the info should be removed from the docs. 😅 https://cdn.discordapp.com/attachments/1337165954131693609/1337447767295135794/IMG_1633.png?ex=67a77acc&is=67a6294c&hm=a41f1558fee83e551a8d23302f95006eef744e5d06a971a7e2d1e04900b32269& https://cdn.discordapp.com/attachments/1337165954131693609/1337447767689134171/IMG_1634.png?ex=67a77acc&is=67a6294c&hm=a1cc38e5d62df730d9f19d86b86de6e2c16c5d9ba47c99b34754f9d0d45c6f37&
Now that I am at my desk with Visual Studio open... I can confirm that while I'm not using Rider (oops just Visual Studio) when I step in, I only see the one method I also can confirm I am on UI Builder 14.0.3 This sounds like a bug I should probably report to them. https://cdn.discordapp.com/attachments/1337165954131693609/1337462794378805268/image.png?ex=67a788cb&is=67a6374b&hm=94d8394285aa57e0282505b25f9be8bd589c8e3ab78835ac7418fdcf53ed888a& https://cdn.discordapp.com/attachments/1337165954131693609/1337462794689450024/image.png?ex=67a788cb&is=67a6374b&hm=b035807ad98e7b65c367a95f6c309f2ff2d440d1c52d86c36ccaa3444044bb1c&
5 Views