Function: search
Use
Effect
This function searches for a text pattern in the content unit of a component. The range of the search can be restricted. The search begins at the point specified by fromOffset and continues until the toOffset point. If fromOffset is greater than toOffset, the function searches the component backwards.
A text pattern is found if the following conditions are met:
-
if fromOffset<= toOffset
-
The location of the first character of the text found is greater than or equal to fromOffset.
-
The location of the last character of the text found is smaller than or equal to toOffset.
-
-
if fromOffset>= toOffset
-
The location of the last character of the text found is smaller than or equal to fromOffset.
-
The location of the first character of the text found is greater than or equal to toOffset.
-
The pattern contains the search string. The string can contain blank characters.
The number of "hits" (text found by the search function) and the hits themselves (up to numResults) are returned as the result. A hit consists of information on the character position. The character position is the position of the hit in relation to the start of the document. The position of the hit location is defined as the position of the first character of the search text, regardless of the direction of the search.
Default
The pattern is searched for in the whole addressed component.
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 |
||
|
compId |
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?search&pVersion=0046&contRep=K1&docId=4B7689654E73D21197E70060B0672A3C&compId=data&pattern=Manfred%20M%FCller&fromOffset=80
A search for "Manfred Müller" is carried out in the component "data" of the named object from offset 80 to the end.
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 for each hit. An ASCII string with the following structure is returned:
number;offset;offset;...
There are no blank spaces between the individual characters. There is a semicolon between the values and at the end.