Add index function to the media field