EPrints Technical Mailing List Archive

Message: #01978


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

[EP-tech] Re: Documentation for EPrint searches


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"