EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #07349


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

[EP-tech] Searching for null/unset values


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