Sort order Search results
Permalink
Hello,
i'm overriding the search block to do a custom search for page attributes. This all seems to work, the pages with the attribute value searched for get returned.
But the alphabetical sorting of the results doesn't work.
in the controller.php - do_search() function i added the following line
but the results come back unsorted
where did i go wrong or what did i miss?
Thank you
gr Marco
i'm overriding the search block to do a custom search for page attributes. This all seems to work, the pages with the attribute value searched for get returned.
But the alphabetical sorting of the results doesn't work.
in the controller.php - do_search() function i added the following line
$ipl->sortByName(); //--should do the sorting? $ipl->filter(false, '(ak_exclude_search_index = 0 or ak_exclude_search_index is null)'); $res = $ipl->getPage();
but the results come back unsorted
where did i go wrong or what did i miss?
Thank you
gr Marco
Hello Jordan
thanks, this was not an urgent problem but one i had to solve in the end. I'm using Concrete 5.5.2.1
I have altered the code from
to
and worked with the results
instead of
i used
then in the view.php i altered everything to use the cID to get the page info instead of the indexedpagelist object.
thanks, this was not an urgent problem but one i had to solve in the end. I'm using Concrete 5.5.2.1
I have altered the code from
$ipl = new IndexedPageList();
to
$ipl = new PageList();
and worked with the results
instead of
$results[] = new IndexedSearchResult($r['cID'], $r['cName'], $r['cDescription'], $r['score'], $r['cPath'], $r['content']);
i used
$results[] = array("cID"=>$r->getCollectionID(), "cName"=>$r->getCollectionName());
then in the view.php i altered everything to use the cID to get the page info instead of the indexedpagelist object.
Wow finally, Thank you so much Jordan ! I have wasted almost all day trying to get sortBy(...) to work in the Search block controller and I thought I was the problem...
So you can either change the search controller and view to use the normal PageList class, or you can override the "IndexedPageList" code so it doesn't override your sorting. Which version of C5 are you using?