protected function PhotosImageSearch::addPhotosImageRankings in Album Photos 8.5
Same name and namespace in other branches
- 6.0.x src/Plugin/Search/PhotosImageSearch.php \Drupal\photos\Plugin\Search\PhotosImageSearch::addPhotosImageRankings()
Adds the configured rankings to the search query.
Parameters
\Drupal\Core\Database\Query\SelectExtender $query: A query object that has been extended with the Search DB Extender.
1 call to PhotosImageSearch::addPhotosImageRankings()
- PhotosImageSearch::findResults in src/
Plugin/ Search/ PhotosImageSearch.php - Queries to find search results, and sets status messages.
File
- src/
Plugin/ Search/ PhotosImageSearch.php, line 447
Class
- PhotosImageSearch
- Handles searching for photos_image entities using the Search module index.
Namespace
Drupal\photos\Plugin\SearchCode
protected function addPhotosImageRankings(SelectExtender $query) {
if ($ranking = $this
->getRankings()) {
$tables =& $query
->getTables();
foreach ($ranking as $rank => $values) {
if (isset($this->configuration['rankings'][$rank]) && !empty($this->configuration['rankings'][$rank])) {
$photos_image_rank = $this->configuration['rankings'][$rank];
// If the table defined in ranking isn't already joined, then add it.
if (isset($values['join']) && !isset($tables[$values['join']['alias']])) {
$query
->addJoin($values['join']['type'], $values['join']['table'], $values['join']['alias'], $values['join']['on']);
}
$arguments = isset($values['arguments']) ? $values['arguments'] : [];
$query
->addScore($values['score'], $arguments, $photos_image_rank);
}
}
}
}