Sun Java System Portal Server 7.2 Developer's Guide

Using the Search API

The Search API is defined in the search.h header file in directory PortalServer-base/sdk/rdm/include.

The Search API defines structures and functions for working with Search objects. For example, the following code uses the functions Search_Create() and Search_InsertStr() to create a Search and add some attribute-value pairs to it:


Search mysearch=Search_Create("DOCUMENT", "http://varrius/doc.htm");
Search_InsertStr(mysearch, "title", "All About Style Sheets");
Search_InsertStr(mysearch, "author", "Robin Styles");
Search_InsertStr(mysearch, "description", "All you need to know about style sheets");

These commands create a Search like the following example:


@document { http://varrius/doc.htm
    title{22}: All About Style Sheets
    author{12}: Robin Styles
    description{38}: All you need to know about style sheets
}

Each Search object contains attribute-value pairs, which are each represented as SearchAVPair objects. Using the Search API, you can get and set values of attributes, you can create and delete attribute-value pairs, you can change the values of attributes, and you can add values to existing attributes. (Some attributes can have multiple values.)

Multiple Search objects can be grouped together into Search streams, which are represented by SearchStream objects. A SearchStream object provides functionality for handling a stream of Search objects. For example, you can use the stream to filter attributes, and print the desired attributes for every Search in the stream.

Thus, the relevant data structures when using the Search API include: