1

I'm using EPiServer 11 version with EPiServer.Find. I have a requirement to fetch all pages for landingPage type and standardPage types in one query.

Can you suggest if it is possible.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
user1641519
  • 377
  • 1
  • 4
  • 17

3 Answers3

1

Thanks for suggestions. I managed to solve this as below.

var results = SearchClient.Instance.Search<PageData().FilterForVisitor().FilterOnCurrentSite()
                        .Filter(x => x.MatchType(typeof(LandingPage)) | x.MatchType(typeof(StandardPage)))
                        .GetContentResult();

Hope, it helps someone.

user1641519
  • 377
  • 1
  • 4
  • 17
0

The documentation uses searching for pages of specific type as an example so I would recommend reading that.

In your case you would just have to add both page types into the query

Asthiss
  • 221
  • 2
  • 8
  • That documentation link refers to the `FindPagesWithCriteria` class. The OP is using "Search & Navigation" (previously known as Episerver Find) which allows for fast searches in an index rather than slow database queries. – Ted Nyberg Jun 16 '21 at 14:05
0

You could filter using MatchType or MatchTypeHierarchy.

Ted Nyberg
  • 7,001
  • 7
  • 41
  • 72