[Yazlist] zoom client and estimated result set size

Mike Taylor mike at indexdata.com
Thu Mar 20 11:39:39 UTC 2014

Here's the code that emits that (from yaz/client/client.c lines 1812-1829:

    if (res->resultSetStatus)
        printf("Result Set Status: ");
        switch (*res->resultSetStatus)
        case Z_SearchResponse_subset:
            printf("subset"); break;
        case Z_SearchResponse_interim:
            printf("interim"); break;
        case Z_SearchResponse_none:
            printf("none"); break;
        case Z_SearchResponse_estimate:
            printf("estimate"); break;
            printf(ODR_INT_PRINTF, *res->resultSetStatus);

That switch corresponds nicely with the text of the standard apart
from what is evidently a non-standard extension --

I checked the more recent Z39.50-2003 version at
http://www.loc.gov/z3950/agency/Z39-50-2003.pdf but section
lists the same Result-set-status values as the 2005 version. I can
find nothing in either version of the standard that suggests there's
any facility for reporting estimates. It's possible that it's in one
of the many Implementor Agreements, Amendments, etc. listed at
http://www.loc.gov/z3950/agency/related95.html but I can't find it
from a brief scan, and they were all supposed to be integrated into
the 2003 version.

So what is that code doing in YAZ-client?  It was introduced by Adam
in commit 9e3111eaac05558be44beadb89eb7ba8c73eb9d5 of Tue Jan 16
14:12:37 2007 +0000, and the commit message reads as follows:

    Extended the GFS search facility. New member of bend_search_rr
    'estimated_hit_count' signals that hits is known to be an estmate
    (higher or lower than real hit count). New member 'partial_resultset'
    signals that the search was partial (hit count is lower or equal than
    real hit count). For Z39.50, the information is stored in resultSetStatus
    member of SearchResponse APDU. For SRU, the information is signalled
    via SRU diagnostic 59: "Result set created with valid partial results

But I can't tell where the idea can from that a new result-set-status
was an appropriate way to communicate this information -- especially
as the standard makes it clear that "Result-set-status occurs if and
only if the value of Search-status is 'failure'".

Anyway, code-reading shows that you can get what you want by fetching
the "resultCountPrecision" option from the ZOOM result-set object. Its
value will be one of the strings "exact" or "estimate". This was
introduced in the much more recent commit
ea0ffea1d02fe623b4da5b7b8aa972aa9f32f071 (also by Adam) of Tue Feb 4
11:25:29 2014 +0100, so I guess you need YAZ 5.0.13 or later for this
to work.

Older version of YAZ should support the "resultSetStatus" option,
which you could use instead, checking for value 4.

But I doubt this is at all widely implemented by servers.

-- Mike.

On 20 March 2014 11:16, Ashley Sanders <a.sanders at manchester.ac.uk> wrote:
> Mike,
>> As far as I know, there is no way for a Z39.50 server to indicate in a
>> search response that the result-count is an estimate. Sorry.
> yaz-client seems to know it's an estimated result set. Note
> the line "Result Set Status: estimate" below.
> $ yaz-client
> Z> open localhost:210/utf8
> Connecting...OK.
> Sent initrequest.
> Connection accepted by v3 target.
> ID     : 120/81
> Name   : Ozzy <copac at mimas.ac.uk>/GFS/YAZ
> Version: 4.2.33 ab2649ca7089099e5f163e93ce90edb5fbfbfa56
> Options: search present triggerResourceCtrl scan sort namedResultSets
> Elapsed: 0.199544
> Z> find @and hayfield derbyshire
> Sent searchRequest.
> Received SearchResponse.
> Search was a success.
> Number of hits: 134, setno 1
> Result Set Status: estimate
> records returned: 0
> Elapsed: 1.020863
> Z>
> Ashley.
> --
> Ashley Sanders a.sanders at manchester.ac.uk
> http://copac.ac.uk -- A Mimas service funded by JISC at the University of Manchester
> _______________________________________________
> Yazlist mailing list
> Yazlist at lists.indexdata.dk
> http://lists.indexdata.dk/cgi-bin/mailman/listinfo/yazlist

More information about the Yazlist mailing list