Function: attrSearch
Use
This function is used for attribute-based searches in print lists (attribute search). It is a prerequisite of this search that a print list has a description file ( compId=descr) as well as a data file ( compId=data). Unlike search this is a specific search, which is carried out in the description file of a print list ( compId=descr). Only the description file is relevant for the implementation of an attribute search.
Basics
The structure of the description file is explained below with the aid of an example.
0 72 DPRL
73 0 DKEYClient....................................0 3
73 0 DKEYcompany_code………………………...3 5
73 0 DKEYaccount_number………………………….8 7
73 0 DKEYcustomer_name………………………….15 25
73 138 DAIN00100010147119Bröselplc
211 120 DAIN001000020147129Obelixplc
...
1147 1 DEPL
The description file consists of a sequence of lines ( index lines). These index lines describe attributes of a range of the relevant data file.
An index line consists of the following:
-
Offset and Length in the data file:
Specification of the Offset and the Length of the range described (in bytes) relative to the start of the data file.
-
Record type
The type of line. The record type consists of four bytes. The following record types are used:
-
DPRL
Prolog
-
DKEY
Description of attributes
-
DAIN
Value of attributes
-
DEPL
Epilog
The various record types occur in the description file in the order specified here. The fact that the DAIN lines come after the DKEY lines is of particular note. Only DKEY and DAIN lines are decisive for the attribute search. The DKEY lines specify the attributes and how they are stored. The DAIN lines specify the attribute values.
-
Parameter
Remaining content of the index line dependent on the record type.
-
The individual index lines are closed with linefeed (0x0A). The value for the "Offset in the data file" increases steadily within the description file.
The structure of the DKEY and DAIN lines is described in detail below.
DKEY lines (description of attributes)
|
Content |
Length (bytes) |
|
Offset in Data File |
Variable |
|
Separator (space) |
1 |
|
Length in Data File |
Variable |
|
Separator (space) |
1 |
|
Record type ("DKEY") |
4 |
|
Attribute names |
40 |
|
Offset in the DAIN Line Parameter |
3 |
|
Length in the DAIN Line Parameter |
3 |
The DKEY lines specify the names (attribute names) and the structure (Offset and Length in the DAIN line parameter) of the attributes that occur in the DAIN lines. The Offset position is counted starting with 0. Each DKEY line describes one particular attribute.
The values "Offset and Length in data file" are not relevant here.
DAIN lines (values of attributes)
|
Content |
Length (bytes) |
|
Offset in Data File |
Variable |
|
Separator (space) |
1 |
|
Length in Data File |
Variable |
|
Separator (space) |
1 |
|
Record type ("DAIN") |
4 |
|
Parameter |
Variable |
Each DAIN line specifies the attribute value for a specific range of the data file. The DAIN line parameter consists of the attribute values corresponding to the standards in the DKEY lines. Blank characters at the end of the DAIN lines are irrelevant. If the DAIN line contains less data than is specified in the DKEY lines, the attributes must be filled with blank characters.
Here, the specifications "Offset and Length in data file" are relevant. They relate to the data file and specify the range for which the given attribute values are valid.
Effect
This function is used for attribute-based searches in print lists. The parameters contRep and docId, and compId describe the component. The parameter pattern specifies the attribute to be searched for, as well as the pattern. The attribute is described in terms of its offset and its length. The pattern is made up of the offset, followed by the character "+", followed by the length, followed by the character "+", followed by the attribute value. If several attributes are to be searched for, the individual pattern s should be separated by a "#".
The patterns can contain any characters. Unsafe and reserved characters are coded as normal here. This is also true for the separator "#" if this occurs in the pattern (see Coding in the URL).
The results of the attribute search are the values for "offset and length in the data file" that match the pattern and are in the search range in the DAIN lines.
For a pattern to be found, the following conditions must be fulfilled:
-
The value for the "offset in the data file" in the DAIN line is within the search range.
-
The attribute values specified in pattern match those in the DAIN line. In other words, each attribute value specified by pattern must be contained fully in the matching attribute value in the DAIN line.
The number of result entries (number of appropriate DAIN lines), and the result entries themselves (values for "offset and length in the data file" in the DAIN line), are returned as the result. A semicolon separates the values. The result entries are sorted according to the search direction. Control of the search direction is as for the search function. The number of results can be restricted by the parameter numResults.
Default
Default The pattern is searched for in the document addressed by the parameters contRep and docId. The compId is not specified in the call. The function always searches in the description file ( compId=descr).
Access Mode
Read (r)
Client -> Server
Client sends an HTTP-GET Request. The URL can contain the following parameters:
|
Parameter |
Optional/Mandatory |
Default |
Sign |
|
contRep |
Mandatory |
X |
|
|
docId |
Mandatory |
X |
|
|
pattern |
Mandatory |
||
|
pVersion |
Mandatory |
||
|
caseSensitive |
optional |
n |
|
|
fromOffset |
optional |
0 |
|
|
toOffset |
optional |
- 1 |
|
|
numResults |
optional |
1 |
|
|
accessMode |
s-mandatory |
X |
|
|
authId |
s-mandatory |
X |
|
|
expiration |
s-mandatory |
X |
|
|
secKey |
optional |
Example
http://pswdf009:1080/ContentServer/ContentServer.dll?attrSearch&pVersion=0046&contRep=K1&docId=361A524A3ECB5459E0000800099245EC&pattern=3+5+12345#15+25+GmbH&numResults=5
In a component, the search function searches the attribute with offset 3 and length 5 for 12345 (this is the company code in the example), and searches the attribute with offset 15 and length 25 for plc (this is the customer name in the example). Up to 5 hits are returned.
Server -> Client
The server answers the request with a response. The response status code indicates the outcome of the call.
|
HTTP Status Code |
Meaning |
|
200 (OK) |
OK, component was searched |
|
400 (bad request) |
Unknown function or unknown parameter |
|
401 (unauthorized) |
Security breach |
|
404 (not found) |
Document or component not found |
|
409 (conflict) |
Document or component inaccessible |
|
500 (Internal Server Error) |
Internal error on Content Server |
The result of the search is the number of hits and the Offset and Length for each hit:
number;offset;length;...
If an attribute search cannot be carried out properly because the values in the attribute do not match the standards in the DKEY lines (for example, attribute names wrong or attribute value too long in the pattern), status code 400 (bad request) is returned.
If, however, nothing is found, the status code is set to 200 (OK) and 0 is returned as the result.