[EP-tech] Re: Documentation for EPrint searches

Sebastien Francois sf2 at ecs.soton.ac.uk
Tue May 28 15:37:57 BST 2013


Hi Ian,

On recent versions of EPrints (this was introduced in the 3.3 branch but 
I'm not sure when exactly) - I tested on a 3.3.11:

my $list = $session->dataset( 'eprint' )->search(
         filters => [
                 { meta_fields => [ 'abstract' ], match => 'SET' },
                 { meta_fields => [ 'title' ], value => 'Fred', match => 
'IN' }
                 ] );

print STDERR "Found ".$list->count." results\n";

I personally like to nest the calls:

$session->dataset( 'eprint' )->search(
         filters => [
                 { meta_fields => [ 'abstract' ], match => 'SET' },
                 { meta_fields => [ 'title' ], value => 'Fred', match => 
'IN' }
] )->map( sub {

     my( undef, undef, $eprint ) = @_;

     # do something with $eprint

} );

otherwise use $list->map( ... );

Seb.

On 28/05/13 15:17, Ian Stuart wrote:
> I'm sure I ask this every 6 months.... and I keep searching the net &
> not find anything...
>
> Is there any documentation on creating searches in EPrints?
>
> I want to find all the eprints where field A is not empty and field B
> has the value "Fred"
>



More information about the Eprints-tech mailing list