Sun Java System Portal Server 7.1 Developer's Guide

Executing A Query and Getting the Results

You submit a query by calling the doQuery() method.

public void doQuery()

The results from Search.doQuery() can be obtained as a Search stream using Search.getResultStream(). The next search will replace the previous result stream reference, so you must process the results or save a reference to the result stream after each query. There are also methods for checking the number of results.

public SearchInputStream getResultStream()

The function getResultStream() returns a SearchInputStream which is used to read the Search hit objects. Each Search object read from the stream corresponds to one result.

public int getHitCount()

The function Search.getHitCount() returns the number of hits that matched the query.

public int getResultCount()

The function Search.getResultCount() returns the number of results that were returned by the server. The result count will be equal to the number requested by the viewHits argument whenever there are enough results available.

public int getDocumentCount()

The function Search.getDocumentCount() returns the total number of documents searched across. This will usually equal the total number of documents in the searched database.