|
Restrict Routines
Restrictors, defined in the database description (.dsc) file, are special types of indexes in the database used in boolean searching to limit the number of records retrieved based on certain categories pertinent to the database, such as language, year, or publication type. An important part of creating the restrict variable definition is deciding which routine you will use to limit the data. The syntax for the restrict variable definition is as follows:
restrict(indexid): restriction routine name([parms]) from(fieldlist)\ mask(mask bit value) [terms(termlist)] [norm(normalization value)]\ [init(init restrictor value)]
where the restriction routine name([parms]) refers to the specific routine syntax. The following table lists all of the possible routines that can be performed for the restrict variable with a link to a description of each routine.
Description of Restrict Routines
Routine
|
Description
|
ifthere_strct
|
Sets the restriction value to the value in parm if the field in fieldlist exists in the record.
|
lang_strct
|
Sets the language restriction value. The following different parameter values invoke different processing:
- parm=0: The language is retrieved from the fixed 008 field, bytes 35-37. The language restriction is set to either 1, 2, 3, 4, 5, 6, or 7, representing english, german, french, latin, spanish, swedish, or russian respectively.
- parm=1: The language is retrieved from the fixed 008 OCLC internal 008 field, bytes 33-35. The language restriction is set to either 1, 2, 3, 4, 5, 6, or 7, representing english, german, french, latin, spanish, swedish, or russian respectively.
- parm=2: This routine should be used when there is more than one language field in the data. It checks only the first occurrence of the language. The restriction value is 1 for nonenglish records and 2 for english records.
- parm=3: This routine checks all occurrences of the language field specified in the fieldlist, and if any of them contains the string 'english', the restriction value is set to 1, otherwise the restriction is set to 2 for nonenglish records.
|
marc_rectyp_strct
|
Retrieve the MARC record type data from the fixed 008 field and sets the restriction value following the same logic as the strmatch_strct function. The following parameter may be used with this function:
- parm=2: The SAMARC data record type compares the first byte of the specified field for record type.
|
strmatch_strct
|
Sets the restriction value based on matching data in the record to strings specified in another database description variable, restrictwords. The parameter for strmatch_strct specifies which restrictwords entry to use. Positional placement of the lookup strings in the restrictwords corresponds to the restriction value that is set. When a string match is found for the first entry in the restrictwords, the restriction bit is set to 1. For example:
restrict(2): strmatch_strct(1) from(245/1) mask(1110000000000000) terms("title1","title2","title3") restrictwords(1): "title1data";"title2data";"title3data";
|
In this scenario, records that have a string 'title1data' in the 245/1 field will have the restriction value of 1. Records with 'title2data' in the 245/1 field will have the restriction value of 2. Records with 'title3data' in the 245/1 field will have the restriction value of 3.
|
stroccur_strct
|
Sets the restriction value based on finding the text string in restrictwords anywhere in the data specified in fieldlist. This function differs from the strmatch_strct function because it searches the whole input field for the text pattern, whereas strmatch_strct performs the string compare functions only from the beginning of the input field. For example:
restrict(3): stroccur_strct(2) from(245/1) mask(1110000000000000) terms("title1","title2","title3") restrictwords(2): "title1data";"title2data";"title3data";
|
In this scenario, records with the string 'this field has title1data' in the 245/1 field will have the restriction value of 1. Records with the string 'this field contains title2data' in the 245/1 field will have the restriction value of 2. Records with the string 'this field contains title3data' in the 245/1 field will have the restriction value of 3.
|
year_strct
|
Sets the year restriction value. The routine name is defined in the restrict variable, but the parameter is selected by the system from the list of parameters described below at database build time according to the data contained in the field that is restricted.
For all the year restriction processing, the restriction value is set by taking the year and subtracting the year base value that is stored in the normalization value. For example, the year is 1990, and the normalization value is 1900. The restriction value is 90. When the search engine does a boolean search on 1990 using the year restriction, it subtracts the normalization value from the search term and does the restriction on the value of 90. This cuts down on the number of bits needed to store the year restriction. The following different parameter values invoke different processing:
- parm=0: The year is retrieved from the fixed 008 field, bytes 8-11.
- parm=1: The year is retrieved from the fixed OCLC internal 008 field, bytes 10-13.
- parm=2: The year is retrieved from the first 4 characters of the field specified in fieldlist.
- parm=3: The year is retrieved from the input field by calling a routine that will retrieve the date stored in various forms such as:
a) YYMMDD, b) MMDDYY, c) YYYY <text>, d) YY <text>, e) <text> YY, f) <text> YYYY, g) [YYYY], h) <text> [YYYY], or i) [YYYY} <text>.
|
See Also
Restrictor Definitions Creating a Database Description (.dsc) File Database Description (.dsc) File: Structure and Syntax Database Description (.dsc) File Example
|