Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Filtering issue



I've just started using Episerver Find and having trouble understanding how it works.

I'm trying to filter RoomPages by their availability status.  

This is my code: 

 var results = query.Client.Search()
                .FilterFacet("test", x => _contentRepository.Get(x.PageLink).IsClosed())

And my extension method looks like this: 

 public static FilterExpression IsClosed(this RoomPage room)
            return new FilterExpression(
                x => x.AvailabilityStatus.Match(Rooms.Status.Closed));

This Match(Rooms.Status.Closed) does'nt seem to work since it returns Roompages with availability status open as well. 

Can someone enlighten me in what I'm doing wrong or provide a better solution for achieving this. 

Thanks in advance

Jun 25, 2015 16:18
 var r = query.Client.Search<RoomPage>()
.Filter(x => _contentRepository.Get<RoomPage>(x.PageLink).IsClosed())

While this returns 0 hits. 

Jun 25, 2015 16:28

You shouldn't fetch the page again in the filter statement. It should work by just doing:

.Filter(x => x.AvailabilityStatus.Match(Rooms.Status.Closed))


Jun 26, 2015 8:23
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.