[EP-tech] Searching with multiple compound fields
Ian.Stuart at ed.ac.uk
Mon Sep 1 09:29:06 BST 2014
In EPrints, one can set up compound fields ("creator" is the classic
example: it has "given name", "Family name", "honorific", and "id"
sub-fields in one EPrint-field.
I've created a similar field, which I'm now using in a search.
Look at http://devel.edina.ac.uk:1203/45477/
I have an EPrint field called "Target repositories", this is a multipul
field, in that I can have more than one "row"
It's also a compound field, in that each item consists of 11 sub-fields.
All is good, and I can happily read & write data to this setup.... not a
Searching, however, has become an issue - and I wasn't aware of the
issue until recently!
I create a search thus:
my $ds = $session->get_repository->get_dataset("archive");
my $search = EPrints::Search->new(
satisfy_all => 1,
session => $session,
dataset => $ds,
my $date_range = '2000-01-01-3000-12-31';
$search->add_field( $dso->get_field("broker_sent"), $date_range );
$search->add_field( $dso->get_field("broker_live"), '', 'EX' );
print $search->render_description->toString if ( $noise > 0 );
This prints a search string that says
Date sent is between 01 January 2000 and 31 December 3000 inclusive
<b xmlns="http://www.w3.org/1999/xhtml">AND</b> Date went live is
Unfortunately it's picking up eprintid 45477 - when obviously (to a
human) it shouldn't.
So - how do I restrict a search so that the terms have to be within a
single "row" of a multiple compound field?
Developer: ORI, RJ-Broker, and OpenDepot.org
Bibliographics and Multimedia Service Delivery team,
The University of Edinburgh.
This email was sent via the University of Edinburgh.
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the Eprints-tech