Start of Content Area

Background documentation Function: search  Locate the document in its SAP Library structure

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:

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.

The pattern is searched for in the whole addressed component.

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

   

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

   

Note

s-mandatory means that this parameter need only be specified if the URL is signed.

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.

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;length;...

There are no blank spaces between the individual characters. There is a semicolon between the values and at the end.

Example

2;122;222;

End of Content Area