user1641519
user1641519

Reputation: 387

Get all pages for particular page types

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.

Upvotes: 1

Views: 1298

Answers (3)

Ted Nyberg
Ted Nyberg

Reputation: 7391

You could filter using MatchType or MatchTypeHierarchy.

Upvotes: 0

user1641519
user1641519

Reputation: 387

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.

Upvotes: 1

Asthiss
Asthiss

Reputation: 221

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

Upvotes: 0

Related Questions