6. Scan
Prev | Chapter 3. ZOOM | Next

## 6. Scan

This section describes an interface for Scan. Scan is not an official part of the ZOOM model yet. The result of a scan operation is the `ZOOM_scanset` which is a set of terms returned by a target.

The Scan interface is supported for both Z39.50, SRU (and SOLR?).

        ZOOM_scanset ZOOM_connection_scan(ZOOM_connection c,
                                          const char *startpqf);

        ZOOM_scanset ZOOM_connection_scan1(ZOOM_connection c,
                                           ZOOM_query q);

        size_t ZOOM_scanset_size(ZOOM_scanset scan);

        const char *ZOOM_scanset_term(ZOOM_scanset scan, size_t pos,
                                      size_t *occ, size_t *len);

        const char *ZOOM_scanset_display_term(ZOOM_scanset scan, size_t pos,
                                              size_t *occ, size_t *len);

        void ZOOM_scanset_destroy(ZOOM_scanset scan);

        const char *ZOOM_scanset_option_get(ZOOM_scanset scan,
                                            const char *key);

        void ZOOM_scanset_option_set(ZOOM_scanset scan, const char *key,
                                     const char *val);

The scan set is created by function `ZOOM_connection_scan` which performs a scan operation on the connection using the specified `startpqf`. If the operation was successful, the size of the scan set can be retrieved by a call to `ZOOM_scanset_size`. Like result sets, the items are numbered 0,..size-1. To obtain information about a particular scan term, call function `ZOOM_scanset_term`. This function takes a scan set offset `pos` and returns a pointer to a raw term or `NULL` if non-present. If present, the `occ` and `len` are set to the number of occurrences and the length of the actual term respectively. `ZOOM_scanset_display_term` is similar to `ZOOM_scanset_term` except that it returns the display term rather than the raw term. In a few cases, the term is different from display term. Always use the display term for display and the raw term for subsequent scan operations (to get more terms, next scan result, etc).

A scan set may be freed by a call to function `ZOOM_scanset_destroy`. Functions `ZOOM_scanset_option_get` and `ZOOM_scanset_option_set` retrieves and sets an option respectively.

The `startpqf` is a subset of PQF, namely the Attributes+Term part. Multiple `@attr` can be used. For example to scan in title (complete) phrases:

@attr 1=4 @attr 6=2 "science o"

The `ZOOM_connecton_scan1` is a newer and more generic alternative to `ZOOM_connection_scan` which allows to use both CQL and PQF for Scan.

Table 3.4. ZOOM Scan Set Options

Option | Description | Default
--- | --- | ---
number | Number of Scan Terms requested in next scan. After scan it holds the actual number of terms returned. | 20
position | Preferred Position of term in response in next scan; actual position after completion of scan. | 1
stepSize | Step Size | 0
scanStatus | An integer indicating the Scan Status of last scan. | 0
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

Prev | Up | Next
5. Facets | Home | 7. Extended Services