[EP-tech] Creating searches in EPrints?

Ian Stuart Ian.Stuart at ed.ac.uk
Fri Dec 7 12:14:05 GMT 2012


Is this documented anywhere? I'm not finding anything...

If I have the following defined for an eprint dataObject:

         {
             'name' => 'broker',
             'type' => 'compound',
             'multiple' => 1,
             'fields' => [
                   { sub_name => 'orgid',    'type' => 'text' },
                   { sub_name => 'orgname',  'type' => 'text' },
                   { sub_name => 'repoid',   'type' => 'text' },
                   { sub_name => 'reponame', 'type' => 'text' },
                   { sub_name => 'sword',    'type' => 'boolean' },
                   { sub_name => 'sent',     'type' => 'time', },
                   { sub_name => 'return',   'type' => 'url' },
                   { sub_name => 'live',     'type' => 'time', },
                   { sub_name => 'target',   'type' => 'url' },
                   { sub_name => 'note',     'type' => 'text' },
                   { sub_name => 'archiver', 'type' => 'boolean' },
                         ],
           },

I should be able to create a search thus:

   my $dso = $session->get_repository->get_dataset("archive");
   my $searchexp1 = EPrints::Search->new(
     satisfy_all => 1,
     session     => $session,
     dataset     => $dso,
   );
   $searchexp1->add_field( $dso->get_field("broker_sword"), 'TRUE' );
   $searchexp1->add_field( $dso->get_field("broker_sent"),  '2000-' );
   $searchexp1->add_field( $dso->get_field("broker_live"),  '' );
   my $results1 = $searchexp1->perform_search;

As I understand it, this should list only those records where one or 
more of the broker elements has the sub_field "sword" set true, and the 
sub_field "sent" defined and after the year 2000, and the sub_field 
"live" is empty
.... unfortunately, I'm getting records where sub_field "sword" is true, 
but none of the broker elements have a "sent" sub_field

Is there anything out there?

-- 

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.



More information about the Eprints-tech mailing list