EPrints Technical Mailing List Archive

Message: #08526


< 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,

I think John's suggestion is better as it is basically what I was suggesting with the succeeded field but already exists. (I was gettting a bit to carried away with the versioning problem to remember about metadata_visibility).  Having had issues in the past with people reporting that items that should be searchable are not, I would say that metadata_visibility can occasionally have discrepancies, like when dealing with the intermediate version issues I described, along with other scenarios that can somehow lead to the field being set wrong.

It should be noted that metadata_visibility has three possible values: show, hide, no_search.  However, a comment in the perl_lib/EPrints/DataObj/EPrint.pm says:

"The 'hide' option may be used to force an eprint to not appear in search/views but is not considered a stable option."

So it is probably safe to consider just no_search to be what you need to map to OAI-PMH 'deleted'.  As there is no where in the core codebase that can set this field to 'hide', it would only be possible if you made this field editable to users as it would appear as a set field with these three options.  The reason it says this is not 'stable' is that conditional statements in the core code may not behave unexpectedly as they were not coded with hide being a potential value in mind.

Regards

David Newman

On 17/02/2021 15:28, John Salter wrote:
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%7Cb15bba50a313466c202008d8d360eefe%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491760690506355%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=B4SrCr8l9T5C3fLxU0zgZGXbe%2BL24rzNZUYXWf4k2bQ%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%7Cb15bba50a313466c202008d8d360eefe%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491760690516348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=XvHtTQQuQ6jBwYcCkp4Ai15LicYj4zFW%2FvhI7zxmHd4%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%7Cb15bba50a313466c202008d8d360eefe%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491760690516348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=jobKrS4K0il3J%2FbwjAuaRlgO%2B2vB%2BCJuMetzGw83hiA%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%7Cb15bba50a313466c202008d8d360eefe%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491760690516348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=WggXOHs9pTDitCsh9%2Fk1zp2PGDyX2%2BtAar23JUGL9jk%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%7Cb15bba50a313466c202008d8d360eefe%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491760690516348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=XvHtTQQuQ6jBwYcCkp4Ai15LicYj4zFW%2FvhI7zxmHd4%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%7Cb15bba50a313466c202008d8d360eefe%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637491760690516348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=jobKrS4K0il3J%2FbwjAuaRlgO%2B2vB%2BCJuMetzGw83hiA%3D&amp;reserved=0