X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsearch%2Fsrc%2FPlugin%2Fviews%2Fsort%2FScore.php;fp=web%2Fcore%2Fmodules%2Fsearch%2Fsrc%2FPlugin%2Fviews%2Fsort%2FScore.php;h=f5910f0d56ecc2741feca373d8b963815d21f848;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/search/src/Plugin/views/sort/Score.php b/web/core/modules/search/src/Plugin/views/sort/Score.php new file mode 100644 index 000000000..f5910f0d5 --- /dev/null +++ b/web/core/modules/search/src/Plugin/views/sort/Score.php @@ -0,0 +1,38 @@ +search_score -- and we also + // need to check its relationship to make sure that we're using the same + // one or obviously this won't work. + foreach (['filter', 'argument'] as $type) { + foreach ($this->view->{$type} as $handler) { + if (isset($handler->search_score) && $handler->relationship == $this->relationship) { + $this->query->addOrderBy(NULL, NULL, $this->options['order'], $handler->search_score); + $this->tableAlias = $handler->tableAlias; + return; + } + } + } + + // Do nothing if there is no filter/argument in place. There is no way + // to sort on scores. + } + +}