commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / views / modules / search / views_handler_sort_search_score.inc
1 <?php
2
3 /**
4 * @file
5 * Definition of views_handler_sort_search_score.
6 */
7
8 /**
9 * Field handler to provide simple renderer that allows linking to a node.
10 *
11 * @ingroup views_sort_handlers
12 */
13 class views_handler_sort_search_score extends views_handler_sort {
14 function query() {
15 // Check to see if the search filter/argument added 'score' to the table.
16 // Our filter stores it as $handler->search_score -- and we also
17 // need to check its relationship to make sure that we're using the same
18 // one or obviously this won't work.
19 foreach (array('filter', 'argument') as $type) {
20 foreach ($this->view->{$type} as $handler) {
21 if (isset($handler->search_score) && $handler->relationship == $this->relationship) {
22 $this->query->add_orderby(NULL, NULL, $this->options['order'], $handler->search_score);
23 $this->table_alias = $handler->table_alias;
24 return;
25 }
26 }
27 }
28
29 // Do absolutely nothing if there is no filter/argument in place; there is no reason to
30 // sort on the raw scores with this handler.
31 }
32 }