perform()

Description

int perform (string rpn [, string sort, int from, int how_many])

A function that will do all the numerous PHP/YAZ calls so that the next thing to do is only to retrieve the records.

Of the arguments only the rpn query is required, the others have predefined defaults. The rpn query can either be user specified or alternatively generated (e.g. using the ccl2rpn() method) but there is no check that the rpn query is valid, so an invalid query will result in failure.

The sort criteria can be used where desired, and if not specified, the result set will be sorted according to the system default, which varies. For more information on the syntax of the sort query, please consult more appropriate documentation sources, or the examples below.

Of the from and how_many arguments only from is the interesting one, as how_many can be overrid in the next() method. The from method is mainly interesting when wanting to start the retrieval from a certain position, e.g. when using a page index where only 10 hits are visible per page.

Examples

Example of an rpn-query; this query selects all items which have an author that contains "jansson"


@attr 1=1004 'jansson'

The first example is an sorting query that will sort according to title, ascending and case insensitive, and the second will first sort according to author then title, both ascending and case insensitive.


1=4 ai



1=1004 ai 1=4 ai

Example of a search request when we want to search for authors containing "jansson", sort the results according to author and title, and start from the 30th record.


... initialize ...

$search->perform("@attr 1=1004 jansson", "1=1004 ai 1=4 ai", 30);
while ($record = $search->next(10)) {
   ... manipulate ...
}

... end ...