EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #08516


< 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


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%7C9cdc39f664c145b9273508d8d3319e21%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491557343491436%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=KFbBhwNCarjS8lyWVzChguyW7%2FpYUQwSX%2Bu%2F4osHgn4%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%7C9cdc39f664c145b9273508d8d3319e21%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491557343491436%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=l1NzWmUxJ9nre8VDrqOcX0Fg6j33tUmDW%2B8ft0Q2WRQ%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%7C9cdc39f664c145b9273508d8d3319e21%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491557343491436%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=knemAdNwRI%2BkZhR40dI1qJbztje0ki9XNggbNsSETfE%3D&amp;reserved=0