Created
March 2, 2015 11:14
-
-
Save pedrorocha-net/f7fe05a018b8e1917577 to your computer and use it in GitHub Desktop.
Drupal Search module customisation to allow display priority settings for each content type (to allow showing certain types first in the default search module)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function HOOK_ranking() { | |
$rankings = array(); | |
$types = node_type_get_types(); | |
foreach ($types as $type) { | |
$rankings[$type->type . '_node_type_boost_search'] = array( | |
'title' => t('Boost "' . $type->name . '" nodes'), | |
'arguments' => array(':type' => $type->type), | |
'score' => ' FIND_IN_SET(n.type, :type)', | |
); | |
} | |
return $rankings; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment