The Introduction to FAST Search API provides an introduction on how to use the FAST API. The following code explains how to get all documents from a FAST collection.

When a search query is sent to FAST, FAST prepares a result set with a maximum of 4020 documents. By passing in two query parameters: offset and hits, it is possible to page through the documents in the result set.

The parameter, offset, can be any value between 0 and 4020. The KB article explains the restriction in greater detail. The parameter, hits, is the page size returned by FAST. By default, offset is 0 and hits is 10. In the above example, hits is set to a value of 100.

While retrieving a large number of documents (100), there is a possibility of the query timing out. To avoid timeout errors, the Search operation should be retried, if a timeout exception occurs.

The result from FAST has a IDocumentSummary collection, which can enumerated. IDocumentSummary has a collection of fields. In the above example, the field with the name, country, is retrieved.

While iterating through the document collection, there is a possibility of exception, even though MoveNext method returns true. I believe this is a bug with the API. Silently ignore the exception.

The HttpSearchEngine class also exposes the FetchDocuments method. Though the FetchDocuments method succeeds, it is not possible to retrieve the document collection from the result. This could be another bug with the API. In any case, FetchDocuments is an undocumented part of the FAST Search API.

Getting all documents from a FAST collection
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *