EPrints Technical Mailing List Archive

Message: #03408


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

[EP-tech] Writing slightly more complex searches


Gentle-beings, wonder-folk, and those that lurk....

I'm trying to do

  search for A and (B or C)

For example:

  search for userid=42
         AND (ispublished = 'pub' OR refereed = 'TRUE')

Now, before adding in the "OR" bit, setting up the search is simple:

  $dso = $session->get_repository->get_dataset('archive');
  $searchexp1 = EPrints::Search->new(
     satisfy_all => 1,
     session     => $session,
     dataset     => $dso,
  );
  $searchexp1->add_field( $dso->get_field('userid'),      '42', );
  $searchexp1->add_field( $dso->get_field('ispublished'), 'pub', 'EQ' );


.... but adding in referred causes a problem:
  $searchexp1->add_field( $dso->get_field('userid'),      '42', );
  $searchexp1->add_field( $dso->get_field('ispublished'), 'pub', 'EX' );
  $searchexp1->add_field( $dso->get_field('refereed'),    'TRUE' );

(this is "A AND B AND C")

Any tips?

--

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.