EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #00925
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] Searching in EP3.2
- To: eprints <eprints-tech@ecs.soton.ac.uk>
- Subject: [EP-tech] Searching in EP3.2
- From: Ian Stuart <Ian.Stuart@ed.ac.uk>
- Date: Wed, 08 Aug 2012 11:14:02 +0100
Confused here.... I'm trying to restrict a search, and it's returning 0 results when it should return 19:
This works: my $dsd = $session->get_repository->get_dataset("dark_archive"); my $searchexp2 = EPrints::Search->new( satisfy_all => 1, session => $session, dataset => $dsd, ); # dark archive $searchexp2->add_field($dsd->get_field("special_field"), 'FALSE'); $searchexp2->add_field($dsd->get_field("special_field2"), ''); my $results2 = $searchexp2->perform_search; my $count = $results2->count; print "$count records to check\n"; foreach my $epid (sort @{$results2->ids}) { my $ep = $dso->dataobj($epid); next unless $ep->value("field3") eq 'Foo Bar'; ## do stuff } ... this produces 19 results(notice the 'next' statement in the foreach loop.... a wasteful way of doing things.)
When I try: my $dsd = $session->get_repository->get_dataset("dark_archive"); my $searchexp2 = EPrints::Search->new( satisfy_all => 1, session => $session, dataset => $dsd, ); # dark archive $searchexp2->add_field($dsd->get_field("special_field"), 'FALSE'); $searchexp2->add_field($dsd->get_field("special_field2"), ''); $searchexp2->add_field($dsd->get_field("field3"), 'Foo bar'); my $results2 = $searchexp2->perform_search; my $count = $results2->count; print "$count records to check\n"; foreach my $epid (sort @{$results2->ids}) { my $ep = $dso->dataobj($epid); ## do stuff } ... this produces 0 results! Why? -- Ian Stuart. Developer: ORI, RJ-Broker, and OpenDepot.org Bibliographics and Multimedia Service Delivery team, EDINA, The University of Edinburgh. http://edina.ac.uk/ This email was sent via the University of Edinburgh. The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
- Follow-Ups:
- [EP-tech] Re: Searching in EP3.2
- From: Tim Brody <tdb2@ecs.soton.ac.uk>
- [EP-tech] Re: Searching in EP3.2
- Prev by Date: [EP-tech] Re: Custom View Item Renderer
- Next by Date: [EP-tech] Re: Searching in EP3.2
- Previous by thread: [EP-tech] Custom View Item Renderer
- Next by thread: [EP-tech] Re: Searching in EP3.2
- Index(es):