Epi Search - Specify order



I’m using EPi Search to find x number of newspages and display these in a list. To get the next x number of news the visitor hits a ”Show more” button.

The search works fine, but the problem is that it returns the oldest pages first. I want the latest created pages to be returned first. 

I can't sort the pages after the search is performed since we are not searching for all newspages at a time.

Is it possible to specifiy an order when using EPi Search?


Thanks for your help


Apr 26, 2017 15:00

How about something like this?

new FilterSort(FilterSortOrder.CreatedDescending).Filter(_newsPageItems);

Apr 26, 2017 21:00

Can you post the code snippet you are using? 

Apr 26, 2017 21:02


I think the FilterForVisitor is wrong, because I think Malin wants to set the sortorder when doing the search, not after. 

For example if it was Find, she could do this: 

    .OrderBy(x => x.PublicationDate)

I think it's something like that she wants to do in Search

/ Henric

Apr 27, 2017 8:44

Thanks for your reply. Henric is right, I need to sort while searching. 

This is how we are performing the search

var Locate = ServiceLocator.Current.GetInstance<ServiceLocationHelper>();

GroupQuery groupQuery = new GroupQuery(LuceneOperator.AND);

var contentTypesQuery = new GroupQuery(LuceneOperator.OR);

//Here we are specifying what type to search for, ex searchOnType = newspages

contentTypesQuery.QueryExpressions.Add(new TypeContentQuery(searchOnType));


VirtualPathQuery pathQuery = new VirtualPathQuery();

pathQuery.AddContentNodes(searchRoot, Locate.ContentLoader());


AccessControlListQuery aclQuery = new AccessControlListQuery();

aclQuery.AddAclForUser(PrincipalInfo.Current, httpContext);


//Here is were I perform the search and only take x number of items (value of pagingNumber * pagingSize). 

var results = Locate.SearchHandler().GetSearchResults(groupQuery, pagingNumber, pagingSize);

Apr 27, 2017 11:11

The search returns the pages in the order they were indexed.

So the most recently updated pages, which have been indexed last, is returned last. 

I would like to do quite the opposite, but without having to get all search hits first.  

Apr 27, 2017 11:18
* 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.