EPiServer Find Sample

  • Basic
  • Sorting
  • Paging
  • Highlighting
  • Filters
  • Facets
  • Autocomplete
  • Map

Paging Basic search listing with paging

Try an empty search or searching for "hotel" to get many hits and use the paging control at the bottom of the page.

View Source
int pageSize = 10;
var page = p ?? 1;

var results = client.Search<Hotel>()
    .For(q)
    .Take(pageSize)
    .Skip((page-1) * 10)
                            .Select(x => new SearchHit
                            {
                                Title = x.Name,
                                Url = x.Website,
                                Location = new List { x.ShortAddress, x.Location.Title, x.Location.Country.Title }.Concatenate(", "),
                                StarRating = (int) x.StarRating
                            })
    .GetResult();