Next Previous Contents

6. Scan

To perform scan, a scan object must be created by the ir-scan command. This command has two arguments -- name of the scan object and name of the ir object. Basically, the scan object, provides one scan action which sends a scan request to the target. The action is followed by a string describing starting point of the term list. The format used is a simple subset of the query used in search requests. Only @attr specifications and simple terms are allowed. The settings that affect the scan are:

stepSize integer

Step size. Default is 0.

numberOfTermsRequested integer

Number of terms requested. Default is 20.

preferredPositionInResponse integer

Preferred position in response. Default is 1.

databaseNames list

Database names. Note that this setting is not (yet) supported for the scan object. You must set this for the ir object instead.

referenceId string

Reference-id. If string is empty no reference-id is used.

scanResponse list

Scan-response Tcl script.

callback list

General response Tcl script. Only used if scanResponse is not specified. This setting is valid only for the ir object -- not the ir-set object.

The scan object normally holds one or more scan line entries upon successful completion. The table below summarizes the settings that should be used in a response handler.

scanStatus returns integer

Scan status. An integer between 0 and 6.

numberOfTermsReturned returns integer

Number of terms returned.

positionOfTerm returns integer

An integer describing the position of term.

scanLine returns list

This function returns information about a given scan line (entry) at a given index specified by the integer. The first scan line is numbered zero; the second 1 and so on. A list is returned by the scanLine setting. The first element is T if the scan line is a normal term and SD if the scan line is a surrogate diagnostic. In the first case (normal) the scan term is second element in the list and the number of occurences is the third element. In the other case (surrogate diagnostic), the second element is the diagnostic code, the third a text representation of the error code and the fourth element is additional information.

referenceId returns string

Reference-id of scan response.

Example

We will scan for the terms after science in the Title index. We will assume that an ir object called z-assoc has already been created.

   z-assoc callback {scan-response}
   ir-scan z-scan z-assoc
   z-scan scan "@attr 1=4 science"
  
   proc scan-response {} {
       set status [z-scan status]
       if {$status == 0} {
           set no [z-scan numberOfTermsReturned]
           for {set i 0} {$i < $no} {incr i} {
               set line [z-scan scanLine $i]
               set type [lindex $line 0]
               if {$type == "T"} {
                   puts [lindex $line 1]
               } elseif {$type == "SD"} {
                   puts [lindex $line 1]
               }
           }
       }
   }
End of examle


Next Previous Contents