Sorting simple search results

Hi,
I’m trying to sort the results coming from the simple search. I would like to have the results ordered by Dublin Core , language. I have seen the solution suggested by patrickmj a couple of years ago to create a new simple plugin like this:

class SortPlugin extends Omeka_Plugin_AbstractPlugin
{
    protected $_filters = array('search_texts_browse_params');

    public function filterSearchTextsBrowseParams($params)
    {
        $params['sort_field'] = "title";
        $params['sort_dir'] = 'a';
		
        return $params;
    }
}

but it doesn’t seem to work when I change the $params[‘sort_field’] = “Dublin Core,Language”;

Any suggestions?

The simple search results come from a different place in the database, one that’s not aware of the different Dublin Core fields or things like that. “title” works because its part of whats stored in that separate search table, but something like language wouldn’t be.

Sorting by the Language value would involve significantly more work as you’d have to try to join the search text table with the regular ElementText table, and there’d be some issues as to how it works with things that aren’t Items (as the sitewide search includes other records, even ones that don’t have element-based metadata at all).

After a while I can now order my simple search for D C element. For thet I just added this few line to the index.php in show directory

parse_str($_SERVER['QUERY_STRING'], $queryarray);

$queryarray['record_types'] = array('Item');

$textlist = get_db()->getTable('SearchText')->findBy($queryarray);

and then I have orederd the $textlist by this function

function ordinaRicercaGrossa($textlist) {
	 

		
	
	$i=0;
foreach ($textlist as $searchText) {
		
		$record = get_record_by_id($searchText['record_type'], $searchText['record_id']); 
		$recordType = $searchText['record_type']; 
		$record = set_current_record($recordType, $record); 

		$textlist [$i]["Date"] =  metadata('item', array('Dublin Core', 'Language'));
		
		
		
		$i++;
		
		}

foreach ($textlist as $key => $row) {
		$date[$key] = $row['Date'];
}

array_multisort($date, SORT_ASC, $textlist);

return $textlist;	
	
	
}

finally I set the $ text list as a view

set_loop_records('SearchText',$textlist);

My problem is now tha I’not able to loop properly the view

That is when I loop the $textlist I get ALL the items from the $textlist in each page. Is there any simple way to limit the per page items of the new view?