The result set object is a container for records returned from a target.
ZOOM_resultset ZOOM_connection_search(ZOOM_connection, ZOOM_query q); ZOOM_resultset ZOOM_connection_search_pqf(ZOOM_connection c, const char *q); void ZOOM_resultset_destroy(ZOOM_resultset r);
a result set, given a connection and query.
Destroy a result set by calling
Simple clients using PQF only, may use the function
ZOOM_connection_search_pqf in which case
creating query objects is not necessary.
void ZOOM_resultset_option_set(ZOOM_resultset r, const char *key, const char *val); const char *ZOOM_resultset_option_get(ZOOM_resultset r, const char *key); size_t ZOOM_resultset_size(ZOOM_resultset r);
ZOOM_resultset_get sets and gets an option
for a result set similar to
The number of hits, also called result-count, is returned by
Table 3.3. ZOOM Result set Options
|start||Offset of first record to be retrieved from target. First record has offset 0 unlike the protocol specifications where first record has position 1. This option affects ZOOM_resultset_search and ZOOM_resultset_search_pqf and must be set before any of these functions are invoked. If a range of records must be fetched manually after search, function ZOOM_resultset_records should be used.||0|
|count||Number of records to be retrieved. This option affects ZOOM_resultset_search and ZOOM_resultset_search_pqf and must be set before any of these functions are invoked.||0|
|presentChunk||The number of records to be
requested from the server in each chunk (present request). The
value 0 means to request all the records in a single chunk.
(The old ||0|
|elementSetName||Element-Set name of records.
Most targets should honor element set name ||none|
|preferredRecordSyntax||Preferred Syntax, such as
|schema||Schema for retrieval, such as
|setname||Name of Result Set (Result Set ID). If this option isn't set, the ZOOM module will automatically allocate a result set name.||default|
|rpnCharset||Character set for RPN terms. If this is set, ZOOM C will assume that the ZOOM application is running UTF-8. Terms in RPN queries are then converted to the rpnCharset. If this is unset, ZOOM C will not assume any encoding of RPN terms and no conversion is performed.||none|
For servers that support Search Info report, the following
options may be read using
This detailed information is read after a successful search has
This information is a list of of items, where each item is
information about a term or subquery. All items in the list
are prefixed by
where no presents the item number (0=first, 1=second).
searchresult.size to determine the
number of items.
Table 3.4. Search Info Report Options
|searchresult.size||number of search result entries. This option is non-existent if no entries are returned by the server.|
|searchresult.||sub query ID|
|searchresult.||result count for item (number of hits)|
void ZOOM_resultset_sort(ZOOM_resultset r, const char *sort_type, const char *sort_spec); int ZOOM_resultset_sort1(ZOOM_resultset r, const char *sort_type, const char *sort_spec);
ZOOM_resultset_sort1 both sort an existing
result-set. The sort_type parameter is not used. Set it to "yaz".
The sort_spec is same notation as ZOOM_query_sortby and identical
to that offered by yaz-client's
These functions only work for Z39.50. Use the more generic utility
for other protocols (and even Z39.50).
The creation of a result set involves at least a SearchRequest - SearchResponse protocol handshake. Following that, if a sort criteria was specified as part of the query, a SortRequest - SortResponse handshake takes place. Note that it is necessary to perform sorting before any retrieval takes place, so no records will be returned from the target as part of the SearchResponse because these would be unsorted. Hence, piggyback is disabled when sort criteria are set. Following Search - and a possible sort - Retrieval takes place - as one or more Present Requests/Response pairs being transferred.
The API allows for two different modes for retrieval. A high level
mode which is somewhat more powerful and a low level one.
The low level is enabled when searching on a Connection object
for which the settings
largeSetLowerBound are set. The low level mode
thus allows you to precisely set how records are returned as part
of a search response as offered by the Z39.50 protocol.
Since the client may be retrieving records as part of the
search response, this mode doesn't work well if sorting is used.
The high-level mode allows you to fetch a range of records from
the result set with a given start offset. When you use this mode
the client will automatically use piggyback if that is possible
with the target, and perform one or more present requests as needed.
Even if the target returns fewer records as part of a present response
because of a record size limit, etc. the client will repeat sending
present requests. As an example, if option
is 0 (default) and
count is 4, and
piggyback is 1 (default) and no sorting criteria
is specified, then the client will attempt to retrieve the 4
records as part the search response (using piggyback). On the other
hand, if either
start is positive or if
a sorting criteria is set, or if
is 0, then the client will not perform piggyback but send Present
If either of the options
smallSetElementSetName are unset, the value
elementSetName is used for piggyback
searches. This means that for the high-level mode you only have
to specify one elementSetName option rather than three.
Current version of YAZ does not take advantage of a result set id returned by the SRU server. Future versions might do, however. Since the ZOOM driver does not save result set IDs, any present (retrieval) is transformed to a SRU SearchRetrieveRequest with same query but, possibly, different offsets.
schema specifies SRU schema
for retrieval. However, options
preferredRecordSyntax are ignored.
are supported by SRU.
The remaining options
SRU supports CQL queries, not PQF.
If PQF is used, however, the PQF query is transferred anyway
using non-standard element
Solr queries need to be done in Solr query format.
Unfortunately, SRU and Solr do not define a database setting. Hence,
databaseName is unsupported and ignored.
However, the path part in host parameter for functions
ZOOM_connection_connect acts as a
database (at least for the YAZ SRU server).