public function testClearSorts() { $sorts = array('field1' => Query::SORT_DESC, 'field2' => Query::SORT_ASC); $this->query->addSorts($sorts); $this->query->clearSorts(); $this->assertEquals(array(), $this->query->getSorts()); }
/** * Lets modules alter the Solarium select query before executing it. * * @param \Solarium\QueryType\Select\Query\Query $solarium_query * The Solarium query object, as generated from the Search API query. * @param \Drupal\search_api\Query\QueryInterface $query * The Search API query object representing the executed search query. */ function hook_search_api_solr_query_alter(\Solarium\QueryType\Select\Query\Query $solarium_query, \Drupal\search_api\Query\QueryInterface $query) { if ($query->getOption('foobar')) { // If the Search API query has a 'foobar' option, remove all sorting options // from the Solarium query. $solarium_query->clearSorts(); } }
public function clearSorting() { $this->ensureNotExecuted(); $this->selectQuery->clearSorts(); }