By default, Media results are returned just like any other post type. The result (also like other post types) will use the Media title, Caption, and other data to show the entry within the results template.
There are times when instead you would prefer not to have the Media result itself returned, but instead for that Media content to “count” towards the parent post. Enabling SearchWP’s post parent attribution does just that.
Take for example this Page that includes a PDF download to a spec sheet:
The PDF itself has valuable content that should be included in search results, but instead of linking to both the PDF and this Page in the results, we can tell SearchWP to attribute all of the PDF content to the parent Page instead.
With this setting enabled, searching for any content in the PDF will not increase the weight of the PDF itself, but instead attribute all of that keyword weight to the parent Page.
For example: a search term that is present in the PDF (but not the parent Page) is “boxer”. Without Attribute post parent enabled, we see that the result is the PDF itself:
When we enable Attribute post parent, that same search will return the parent Page instead, which in this case is much more useful:
NOTE: When enabling parent attribution, the parent post type MUST be enabled in order for the result to be returned.
Determining the post parent
By default, any Media uploaded when editing any post will define that post as the Media parent. You can check to see which post is the parent by viewing the entry for the file in the Media library:
If using Grid view, click the icon for the file and review the Uploaded To link in the modal sidebar: