While using search intergrations in site, we may need to customize the search results based on the market requirement. We had a similar requirement where pages like contact us, privacy policy need to be excluded from search results page, we achieved this by using following function
function your_module_apachesolr_exclude($entity_id, $entity_type, $row, $env_id) { $exclude_pages = array('1' => 'contact-us', 100 => 'privacy policy'); // Never index page not found node. foreach($exclude_pages as $nid => $page) { if ($nid == $entity_id) { return TRUE; } } return FALSE; }
You might need to reindex the contents for changes to be reflected.