[EP-tech] Searching for null/unset values

John Salter J.Salter at leeds.ac.uk
Wed Jul 4 14:49:26 BST 2018


Hi All,
Can anyone validate this for me?

On this page: https://wiki.eprints.org/w/API:EPrints/Search#add_field  (generated from perldoc in EPrints::Search), the following statement is made for the value:
"value - value to match against (for EX matches, NULL = is_null!)"

This has always seemed very cryptic/unhelpful to me - but I've never needed to get a null search working - until now.

Experimentation has led to the following which seems to work (example: searching buffer for items with no date):

my $ds = $session->dataset( "buffer" );
my $searchexp = $ds->prepare_search();
$searchexp->add_field(
    fields => [
      $ds->field( 'date' ),
    ],
    value => undef,
    match => "EX",
);

-the 'value => undef,' being the critical piece.
Before I add this to the Wiki, can anyone else confirm this is correct?

Cheers,
John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20180704/9e6563b2/attachment.html 


More information about the Eprints-tech mailing list