EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #07351
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Searching for null/unset values
- To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] Searching for null/unset values
- From: "Alan.Stiles" <alan.stiles@open.ac.uk>
- Date: Wed, 4 Jul 2018 15:43:10 +0000
I concur – having tried this in a script against some test data: my $ds = $session->dataset("buffer"); my $searchexp = $ds->prepare_search(); $searchexp->add_field( $ds->get_field("date"), undef, "EX" ); my $list = $searchexp->perform_search(); print STDERR $list->count; Gives me the same number as running the SQL statement SELECT eprintid, date_year FROM eprint WHERE eprint_status = "buffer" AND date_year IS NULL; And replacing the undef with a number (e.g. 2018) gives the same results as ending the SQL with … AND date_year = 2018; Good spot and definitely something that could be clearer in the wiki. Cheers, Alan From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of John Salter 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 |
- Follow-Ups:
- Re: [EP-tech] Searching for null/unset values
- From: "Alan.Stiles" <alan.stiles@open.ac.uk>
- Re: [EP-tech] Searching for null/unset values
- References:
- [EP-tech] Searching for null/unset values
- From: John Salter <J.Salter@leeds.ac.uk>
- Re: [EP-tech] Searching for null/unset values
- From: "Alan.Stiles" <alan.stiles@open.ac.uk>
- [EP-tech] Searching for null/unset values
- Prev by Date: [EP-tech] Revision History Summary View
- Next by Date: Re: [EP-tech] Import by DOI in ORCID plugin
- Previous by thread: [EP-tech] EPrints/CRIS
- Next by thread: [EP-tech] DOI handling in orcid_support_advance
- Index(es):