## Linear Range Searching

December 22, 1997
Linear Range Searching refers to the problem of searching for records where the value of the specified access point is within the interval bounded by the two specified endpoints. (The endpoints must be comparable, in the sense that they are part of a set with an implicit order; examples are integers and dates: if both endpoints are integers, the implied order is normal integer order; if both endpoints are dates, then "date A is less than date B" if date A is "earlier" than date B.)
Note: this implementor agreement does not address, and should not preclude development of implementor agreements which do address, more complex range searching, where the boundaries require specification of more than two points, for example, searching within a polygon.

Examples of linear range searching are "Age greater than 25 and not greater than 49"; and "Publication date greater than 1980 and less than 1984".

A characteristic of linear range searching is that either endpoint may or may not be included. Thus for example when the endpoints are 25 and 49, all four of the following must be expressible:

• greater than 25 and less than 49
• greater than or equal 25 and less than 49
• greater than 25 and less than or equal 49
• greater than or equal 25 and less than or equal 49

### When constructing an operand for linear searching:

• Use the bib-1 relation attribute 'Within' (104).
• Use the form EXTERNAL for Term, and for the external use MultipleSearchTerms-2 (1.2.840.10003.10.5);
• In The definition of MultipleSearchTerms-2:
```                  SEQUENCE OF SEQUENCE{
term  (1)   IMPLICIT TERM,
flag  (2)   IMPLICIT BOOLEAN OPTIONAL}
```
• "SEQUENCE OF" should be exactly two seqences (one for each endpoint);
• 'flag', which is optional in the definition, must be supplied for both sequences; and
• 'flag' is used to indicate whether the endpoint is included or not. 'true' means the endpoint is included.
Thus the definition of MultipleSearchTerms-2, when used for range searching, becomes:
```                SEQUENCE OF SEQUENCE{ -- two sequences; one for each endpoint
term              (1)   IMPLICIT TERM,
endpointIncluded  (2)   IMPLICIT BOOLEAN}
```

Library of Congress