library/Search/General.php
public function searchAttachmentPermalink($permalink, $post)
    {
        if (isset($post->post_type) && $post->post_type == 'attachment') {
            return wp_get_attachment_url($post->ID);
        } else {
            return $permalink;
        }
    }
public function searchAttachmentPermalink($permalink, $post)
    {
        if (isset($post->post_type) && $post->post_type == 'attachment') {
            return wp_get_attachment_url($post->ID);
        } else {
            return $permalink;
        }
    }
public function searchAttachmentPermalink ( $ permalink , $ post ) { if ( isset ( $ post -> post_type ) && $ post -> post_type == 'attachment' ) { return wp_get_attachment_url ( $ post -> ID ) ; } else { return $ permalink ; } }
Get attachment permalink for search result
@param  string  $permalink
@param  WP_Post $post
@return string            Url
Get attachment permalink for search result