FW: Check if item has file in search results list

38 views
Skip to first unread message

Ben Parkes

unread,
Aug 25, 2023, 10:58:04 AM8/25/23
to dspace-c...@googlegroups.com

From: Ben Parkes <Ben.P...@ed.ac.uk>
Date: Friday, 25 August 2023 at 15:55
To: DSpace Community <dspace-commun...@googlegroups.com>
Subject: Check if item has file in search results list

Hello,

 

I am working on an instance of DSpace 7.6 and I have a use case where I am required to display if an item has a file/bitstream attached to it and, if yes, display a download link to that file/bitstream. In all cases the file/bitstream will be a pdf file.

 

I had implemented this previously in 6.x by getting the bitstream info (<xsl:variable name=”bitstreaminfo” select=”util:getBitstreamInfo($handle)/>) then checking if the metsDoc string contains “pdf” (<xsl:when test="normalize-space($bitstreaminfo)">) and creating a download link if the Boolean returns true.

 

I am curious if there is a way to do something similar in the new Angular frontend? I am in the process of upgrading the repository and the client would like to retain all the previous functionality.

 

Thanks,

Ben

 

____________________________

Ben Parkes

Digital Library Software Developer

Digital Library, Library & University Collections, University of Edinburgh 

Argyle House, Lady Lawson Street, Edinburgh EH3 9DR

Pronouns: He, him, his

 

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

DSpace Community

unread,
Aug 25, 2023, 11:46:14 AM8/25/23
to DSpace Community
Hi Ben,

Your use case is unclear to me.  DSpace 7 already has some of these features and it's unclear if you are asking for something else.

In DSpace 7, there is already a way to determine if an Item has a file attached.  If you perform a search, you'll see a "Has Files" filter which allows you to filter the search by Items that have (or do not have) files attached. You can see this behavior on our demo site, e.g. here's a search for "test": https://demo.dspace.org/search?query=test

Once you click on Item, *all* the files (regardless of format) are already displayed as download links. DSpace 7 doesn't have a way to limit the files shown to just PDF, but you could reorder the files so the PDF is displayed first.  Or you could move extra files to a different bundle (only files in the "ORIGINAL" bundle are displayed by default).

I'm not sure if this aligns with your use case. If it doesn't you should describe your use case in more details.  It is possible though that you would need to modify the code in DSpace 7 to align with your use case (not sure).

Tim

Ben Parkes

unread,
Aug 28, 2023, 4:13:56 AM8/28/23
to DSpace Community
Hello Tim,

I am aware of the Has Files filter and that an items files can be download from its full item metadata page.

I need to display a download link on the search results list for each item that has a file. See the image below of how it is displayed in my 6.x implementation.
Image
As you can see I have a link displayed for each item that has a file attached to it which I do by testing to see if an item had a bitstream attached to it and if the resulting string contains pdf.

I hope this clears my use case up.

Thanks,
Ben
Reply all
Reply to author
Forward
0 new messages