Interface StreamingQueryResponse
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Implementing Classes:
StreamedResponseClient
public interface StreamingQueryResponse extends java.io.Closeable
An interface that allows the developer to retrieve results from a streaming search query.Use the
SearchClient.search(StreamingQueryRequest)
to issues streaming queries.IMPORTANT:Results must be retrieved in the following order and result retrieval is NOT thread safe. Attempting to retrieve a response type that was not requested may throw an exception.
- documents - via
getDocumentIds()
orgetDocuments()
depending on the value of the requestedStreamingQueryRequest.DocumentStreamingMode
- facets - via
getFacets()
- you must callStreamingQueryRequest.setStreamFacets(boolean)
to include facet results - query response - via
getQueryResponse()
- See Also:
SearchClient
,StreamingQueryRequest
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cancel()
Force disconnect the client connection.void
close()
Closes the streaming connection.java.lang.Iterable<java.lang.String>
getDocumentIds()
Get the response document ids.java.lang.Iterable<SearchDocument>
getDocuments()
Get the response documents.java.lang.Iterable<StreamingFacetResponse>
getFacets()
Get the facets.QueryResponse
getQueryResponse()
Get the QueryResponse for the query.
-
-
-
Method Detail
-
getDocuments
java.lang.Iterable<SearchDocument> getDocuments() throws java.io.IOException
Get the response documents.This method will throw an exception if documents are not yet available, or were not requested.
- Throws:
java.io.IOException
-
getDocumentIds
java.lang.Iterable<java.lang.String> getDocumentIds() throws java.io.IOException
Get the response document ids.This method will throw an exception if document ids are not yet available, or were not requested.
- Throws:
java.io.IOException
-
getFacets
java.lang.Iterable<StreamingFacetResponse> getFacets() throws java.io.IOException
Get the facets.This method will throw an exception if facets are not yet available, or were not requested.
- Throws:
java.io.IOException
-
getQueryResponse
QueryResponse getQueryResponse() throws java.io.IOException, AttivioException
Get the QueryResponse for the query.This method will throw an exception if the query response is not yet available, or if the query execution resulted in an exception.
NOTE: this method may return
null
if stream was closed prematurely.- Throws:
java.io.IOException
AttivioException
-
close
void close() throws java.io.IOException
Closes the streaming connection.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
cancel
void cancel() throws java.io.IOException
Force disconnect the client connection. Ignores thread guards on purpose.- Throws:
java.io.IOException
-
-