views_handler_sort_search_score.inc

  1. 3.x modules/search/views_handler_sort_search_score.inc
  2. 2.x modules/search/views_handler_sort_search_score.inc

File

modules/search/views_handler_sort_search_score.inc
View source
  1. <?php
  2. /**
  3. * Field handler to provide simple renderer that allows linking to a node.
  4. */
  5. class views_handler_sort_search_score extends views_handler_sort {
  6. function query() {
  7. // Check to see if the search filter added 'score' to the table.
  8. // Our filter stores it as $handler->search_score -- and we also
  9. // need to check its relationship to make sure that we're using the same
  10. // one or obviously this won't work.
  11. foreach ($this->view->filter as $handler) {
  12. if (isset($handler->search_score) && $handler->relationship == $this->relationship) {
  13. $this->query->add_orderby(NULL, NULL, $this->options['order'], $handler->search_score);
  14. $this->table_alias = $handler->table_alias;
  15. return;
  16. }
  17. }
  18. // Do absolutely nothing if there is no filter in place; there is no reason to
  19. // sort on the raw scores with this handler.
  20. }
  21. }