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
var r = query.Client.Search<RoomPage>()
.Filter(x => _contentRepository.Get<RoomPage>(x.PageLink).IsClosed())
While this returns 0 hits.
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))