EPrints Technical Mailing List Archive

Message: #07329


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

Re: [EP-tech] OAI : need some explanations about custom sets and filters


Hi John

Thank you so much for your explanations !

If I do understand your code and the additions for cgi/oai2 that it contains, one could define OAI custom sets with "satisfy_all => 0" and others with "satisfy_all => 1" : am I right or wrong ?

On another hand, related to your remark about this usage "not being a good idea", there is a "global" filters section in oai.pl config file ($oai->{filters}) : wouldn't it be, for your example a way to get only the "archive" eprint status items ???

Best regards
Laurent Cloarec

Le 06/06/2018 à 12:12, John Salter a écrit :
Hi Laurent,
The code that was in my head is below - does that make more sense (I only wrote it in an email - it might not be 100% right!)?

BUT:
*** I DON'T THINK THIS IS A GOOD IDEA ***
Setting the 'satisfy_all' on the search to 0 (an 'OR' join) would mean that the restriction on the eprint_status field would be an OR - and therefore records that matched another filter, but were in the inbox or review area would also be returned - and this is *NOT* what you need!

You could get round this by performing two searches - one on the archive dataset, and the other on the deletion dataset - and then combining both before outputting data.

Cheers,
John

############ Config #############
$oai->{custom_sets} = [
     {
         spec => "test_set",
         name => "test_set",
         filters => [
             { meta_fields => [ "full_text_status" ], value => "public", },
         ],
         satisfy_all => 0, #new option
         },
];

############ cgi/oai2 (see lines flagged with '## addition ##') #############
         push @$filters, {
                 meta_fields => [qw( eprint_status )],
                 value => "archive deletion",
                 match => "EQ",
                 merge => "ANY",
         };

         # custom sets
         my $satisfy_all = 1; ## addition ##
         if( defined $args->{set} )
         {
                 my $custom_sets = $repo->config( "oai", "custom_sets" );
                 my( $info ) = grep { $_->{spec} eq $args->{set} } @{$custom_sets||[]};
                 if( defined $info )
                 {
                         my $_filters = $info->{filters};
                         $_filters = [$info] if !defined $_filters;
                         push @$filters, @$_filters;
                         delete $args->{set};

                         $satisfy_all = $info->{satisfy_all} if defined $info->{satisfy_all};  ## addition ##
                 }
         }

         my $searchexp = $ds->prepare_search(
                         allow_blank => 1,
                         filters => [
                                 @{$filters},
                         ],
                         custom_order => "eprintid",
                         limit => ($PAGESIZE+1),
                         satisfy_all => $satisfy_all, ## addition ##
         );



-----Original Message-----
From: Laurent Cloarec [mailto:Laurent.Cloarec@ut-capitole.fr]
Sent: 06 June 2018 10:02
To: John Salter <J.Salter@leeds.ac.uk>
Cc: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] OAI : need some explanations about custom sets and filters

http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/2018-May/007320.html
[EP-tech] OAI : need some explanations about custom sets and filters

Hi

If EPrints::DataSet::prepare_search calls EPrints::Search::new, I don't see
exactly how one could "define a key on the oai set config to switch satisfy_all
between 1 and 0 as necessary" in such an overloading version of oai2 script...

Best regards
Laurent Cloarec


John Salter J.Salter at leeds.ac.uk
Tue May 29 19:39:04 BST 2018

Hi Laurent,

If I remember correctly, it's an 'AND' in the vanilla oai2 interface.


From: [EPRINTS_ROOT]/cgi/oai2


my $searchexp = $ds->prepare_search(
                         allow_blank => 1,
                         filters => [
                                 @{$filters},
                         ],
                         custom_order => "eprintid",
                         limit => ($PAGESIZE+1) );


EPrints::DataSet::prepare_search calls EPrints::Search::new - the default setting for a search is 'satisfy_all' = 1.


You could copy the cgi script above into:

[EPRINTS_ROOT]/archives/[ARCHIVEID]/cgi/oai2

and define a key on the oai set config to switch satisfy_all between 1 and 0 as necessary.


I have not tried this. It's a possible solution for what you need - but entirely untested!

If it doesn't work, or you have other questions, let me know!


Cheers,

John

PS You may also be interested in http://bazaar.eprints.org/411/ - which  flags anything that has a datestamp, but that is not currently live as 'deleted' in the OAI-PMH interface (which is more compliant with that standard).

The changes may have been merged into the core of EPrints - comparing the cgi/oai2 files should show if this is the case.

________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk <eprints-tech-bounces at ecs.soton.ac.uk> on behalf of Laurent Cloarec <Laurent.Cloarec at ut-capitole.fr>
Sent: 29 May 2018 14:47:52
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] OAI : need some explanations about custom sets and filters

https://wiki.eprints.org/w/OAI

Hi there

As we do need to define an OAI custom set into our repository, I'd like to know
if the different filters criteria work only with an implicit "AND" operator
(unfortunately not "OR"), and if exists a negative operator (kind of "!=>")...

Regards
--
Laurent Cloarec
Service Commun de la Documentation - Service du Numérique Documentaire
Université Toulouse 1 Capitole