I have this line of code
query = query.Filter(i =>
(
!i.MatchTypeHierarchy(typeof(InfoPage))
| (((InfoPage)i).SearchSubsection().Exists()
& ((InfoPage)i).GetSearchSubSection().Contains(SOMETHING))
)
); // I want to check if it contains
I want to check if there is anything like a string contains a substring in FIND query.
Thanks for help in advance. :)
First things first, you are casting to
InfoPage
which indicates that you shouldn't be using Unified search, instead use the typed search feature.Second, contains would typically be referred to as wildcard search.
I wrote a typed search wildcard method a while ago, see https://www.herlitz.io/2016/09/19/episerver-find-wildcard-searching/
Usage example