Forum

Thread tagged as: Question

Ordering Search Results

Am I right in thinking that currently if I use: perch_content_search, I cannot order my results ?

In other words, I would like to do something like this:

perch_content_search($query, array(
   'count'=>5,
   'excerpt-chars'=>300,
   'template'=>'filter-result.html',
   'sort'=>'date',
   'sort-order'=>'DESC',
));

Are there any workarounds to get an ordered list of search results ?

I would have thought that the default result list would be ordered by date, latest first.

Any ideas / advice would be great.

Thanks,

Andy

Andrew Kennedy

Andrew Kennedy 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

The results are ordered by relevance to the query.

Is there anyway I can override this default ?

I do not really want to go making changes to the core files, but I am presuming this is what I will need to do.

Thanks for the response, I figured it was using this as a default.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you just want a listing by date, wouldn't perch_content_custom() be the better route?

There's no option to make search order by anything other than relevance to the query.

Yeah, I think that this is the way I will go.

Thanks for all your help,

Andy