EPrints Technical Mailing List Archive

Message: #08524


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] search filter to show only the last version


CAUTION: This e-mail originated outside the University of Southampton.

[Based on EPrints 3.3]
There is an EPrint metadata field 'metadata_visibility' that controls whether an item is visible in the normal search interface or not.
This is used to only return the most recent version of an EPrint.

It would be worth checking in the database whether this field is getting accurately set for items with later versions.

For the OAI-PMH interface, you need to get all the records - but you might want the OAI representation to be 'deleted' when metadata_visibility = 'no_search'.

Cheers,
John

-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of David R Newman via Eprints-tech
Sent: 17 February 2021 10:49
To: eprints-tech@ecs.soton.ac.uk; Yuri <yurj@alfa.it>
Subject: Re: [EP-tech] search filter to show only the last version

Hi Yuri,

Unfortunately, I don't think this is programatically possible. The
problem is that the succeeds field is used for storing the ID of the
eprint the current eprint succeeds.  This means you cannot filter on
this as you would expect the latest version of an item to have a
succeeds value but you may also have intermediate versions that have
this set, so you would get all but the first version if you filtered on
succeeds being set.

I would probably advise adding something to eprints fields automatic
that checks the succeeds value and sets a succeeded flag (i.e. boolean)
for the item being succeeded and then recommit all your eprint records
or at least ones that have the succeeds field set.  However, you would
need to be careful doing this.  I would probably advise that the
succeeded flag only gets set when the succeeding item goes live and have
a check for if the item is retired, returned to review or deleted and
unset this flag in the succeeded item.  However, I can also see a
problem where you create a new version that never gets put live but has
another new version created from it.  This would break the link back to
the original and the succeeded flag would never get set on the original
version.  Similarly, if the intermediate version got retired this would
unset the succeeded flag on the original version even though it was
technically succeeded by a later version.  However, these edge cases
would include the record in your search when it was not appropriate,
which on the odd occasion is probably not as big a problem as failing to
include a record that is no longer succeeded.

Hope this helps

David Newman

On 17/02/2021 10:22, Yuri via Eprints-tech wrote:
> CAUTION: This e-mail originated outside the University of Southampton.
>
> Hi!
>
>    is there a way to search in Eprints (programmatically, with filters)
> and retrieve only the last version of each eprint? I would like to
> modify the oai script to get only the last version of an item. BTW, are
> the previous versions in eprint marked as "deleted" or is there some
> code I can use to mark them as deleted? Thanks!
>
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce636df2f76eb452ff0a108d8d358bc24%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491725353504119%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=0tb9V5IwRBEkAKcZvsYNCGGROTAuT%2BJcNND%2FWSYehpQ%3D&amp;reserved=0
> *** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce636df2f76eb452ff0a108d8d358bc24%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491725353504119%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=HNQcGdDoPbH3wgUzjPhmNUbmiBeXT1DZAzzZK0S%2B%2FAM%3D&amp;reserved=0

--
This email has been checked for viruses by AVG.
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avg.com%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce636df2f76eb452ff0a108d8d358bc24%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491725353504119%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=5HAvAir%2FohjgutHnxjn5GeXik7CwMB0kFniOR%2FS2ZsE%3D&amp;reserved=0


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce636df2f76eb452ff0a108d8d358bc24%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491725353504119%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=0tb9V5IwRBEkAKcZvsYNCGGROTAuT%2BJcNND%2FWSYehpQ%3D&amp;reserved=0
*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce636df2f76eb452ff0a108d8d358bc24%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491725353504119%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=HNQcGdDoPbH3wgUzjPhmNUbmiBeXT1DZAzzZK0S%2B%2FAM%3D&amp;reserved=0