Want search result to link to item and not pdf file

Patrick helped me with a hack several years ago, but with the new platform, I can’t seem to search for the archived item. Anyway, I would like my search results for items that are pdfs to link to the actual item and not the file, which it is now doing. I’m using the Seasons theme - any help is appreciated. - Nancy

Found the legacy site - so here it is for those who have as many pdf files as my archive.

That happens because the PDF plugin stores the text on the file itself, not the item. Thus, the search results hit the file.

To change the behavior on the search results page, you’d just need to override the default page and make a small change. See this guide to overriding default theme pages. The page you’ll need to copy over is /search/index.php.

When you’ve copied over that file to your theme, make the following change. Just before this line:

<?php set_current_record($recordType, $record); ?>

add this:

<?php if ($recordType == 'File') { $record = $record->getItem(); } ?>

The only thing I would add is that there is no Search folder in the Season theme, so you will need to upload the Search folder from the /application/views/scripts folder into your Seasons theme folder, remove the other two files leaving the index.php file and then make the change listed above.

Cheers,
Nancy