Function:
attrSearchThis 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.The structure of the description file is explained below with the aid of an example.
Content of a description file (extract; the periods stand for blank characters):
0 72 DPRL
73 0 DKEYclient
………………………………0 373 0 DKEYcompany_code
………………………...3 573 0 DKEYaccount_number
………………………….8 773 0 DKEYcustomer_name
………………………….15 2573 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:
Specification of the Offset and the Length of the range described (in bytes) relative to the start of the data file.
Type of line. The record type consists of four bytes. The following record types are used:
Prolog
Description of attributes
Value of attributes
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.
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.
Interpreted content of the description file (extract):
Offset and Length in the data file |
Record type |
Parameter |
||||
0 |
72 |
DPRL |
||||
73 |
0 |
DKEY |
Client |
0 |
3 |
|
73 |
0 |
DKEY |
Company code |
3 |
5 |
|
73 |
0 |
DKEY |
Account number |
8 |
7 |
|
73 |
0 |
DKEY |
Customer name |
15 |
25 |
|
73 |
138 |
DAIN |
001 |
0001 |
0147119 |
Bröselplc |
211 |
120 |
DAIN |
001 |
0002 |
0147129 |
Obelixplc |
… |
||||||
1147 |
1 |
DEPL |
The structure of the DKEY and DAIN lines is described in detail below.
DKEY lines (description of attributes)
Content |
Length (in 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 (in 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.
The content of the above example is as follows:
Description of attributes
Attribute Name |
Offset in the DAIN Line Parameter |
Length in the DAIN Line Parameter |
Client |
0 |
3 |
Company code |
3 |
5 |
Account number |
8 |
7 |
Customer name |
15 |
25 |
Attribute Values
Offset in Data File |
Length in Data File |
Attribute Name |
Attribute Value |
73 |
138 |
Client |
"001" |
Company code |
"00001" |
||
Account number |
"0147119" |
||
Customer name |
"Bröselplc" |
||
211 |
120 |
Client |
"001" |
Company code |
"00002" |
||
Account number |
"0147129" |
||
Customer name |
" Obelixplc" |
||
… |
… |
… |
… |
This function is used for attribute-based searches in print lists. The parameters
ContRep and docId 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 patterns 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 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
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).Read (r)
The client sends an
HTTP-GET-Request. The URL contains 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 |
s-mandatory means that this parameter must only be specified if the URL is signed.
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.
As you can see in the example, # is not encoded as a separator.
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;...
2;73;138;211;120;
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.