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
How about something like this?
Can you post the code snippet you are using?
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
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
VirtualPathQuery pathQuery = new VirtualPathQuery();
AccessControlListQuery aclQuery = new AccessControlListQuery();
//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);
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.