public abstract class AbstractBridge
extends java.lang.Object
The Bridge is the class responsible for marshalling a query to and from the search service.
Because the bridge holds a connection pool that is expensive to create, it is highly recommended
that the bridge is held in the application memory scope and reused where appropriate.
Do not create a new bridge object for each request as you will incur overhead that will
bring down your UI servers when under heavy load!
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
clientKey |
static java.lang.String |
CLUSTER |
protected static java.lang.String |
COLON |
protected static java.lang.String |
HTTP |
protected static java.lang.String |
HTTPS |
| Constructor and Description |
|---|
AbstractBridge(java.lang.String clientKey,
java.lang.String baseUrl)
Constructor to create a bridge object that connects to the search api. |
AbstractBridge(java.lang.String clientKey,
java.lang.String baseUrl,
boolean compressResponse)
Constructor to create a bridge object that connects to the search api. |
| Modifier and Type | Method and Description |
|---|---|
protected java.io.InputStream |
fireRequest(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> urlParams,
java.lang.String body,
boolean returnBinary) |
protected java.net.URI |
generateURI(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> params,
int tries) |
java.lang.String |
getBridgeRefinementsUrl() |
java.lang.String |
getBridgeUrl() |
java.lang.String |
getClusterBridgeUrl() |
protected Results |
map(java.io.InputStream data,
boolean returnBinary) |
protected RefinementsResult |
mapRefinements(java.io.InputStream data,
boolean returnBinary) |
RefinementsResult |
refinements(Query query,
java.lang.String navigationName)
Connects to the refinements service, parses the response into a model
Retrieves at most 10,000 refinements for the navigation specified. |
Results |
search(Query query)
Connects to the search service, parses the response into a model
|
void |
setRetryTimeout(long retryTimeout)
Sets the retry timeout for a failed request. |
void |
shutdown()
Cleanup HTTP connection pool. |
public static final java.lang.String CLUSTER
protected static final java.lang.String COLON
protected static final java.lang.String HTTP
protected static final java.lang.String HTTPS
protected java.lang.String clientKey
public AbstractBridge(java.lang.String clientKey,
java.lang.String baseUrl)
Constructor to create a bridge object that connects to the search api.
JSON Reference:
The key as found in your key management page in the command center
{"clientKey": ""}
clientKey - The key as found in your key management page in the command
center.baseUrl - The base url the bridge is serving on.public AbstractBridge(java.lang.String clientKey,
java.lang.String baseUrl,
boolean compressResponse)
Constructor to create a bridge object that connects to the search api.
JSON Reference:
The key as found in your key management page in the command center
{"clientKey": ""}
clientKey - The key as found in your key management page in the command
center.baseUrl - The base url the bridge is serving on.compressResponse - true to compress the response content, false to send uncompressed response.public java.lang.String getClusterBridgeUrl()
public Results search(Query query) throws java.io.IOException
Connects to the search service, parses the response into a model
query - A query representing the search.java.io.IOExceptionprotected java.io.InputStream fireRequest(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> urlParams,
java.lang.String body,
boolean returnBinary)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getBridgeUrl()
protected Results map(java.io.InputStream data, boolean returnBinary)
protected java.net.URI generateURI(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> params,
int tries)
throws java.net.URISyntaxException
java.net.URISyntaxExceptionpublic RefinementsResult refinements(Query query, java.lang.String navigationName) throws java.io.IOException
Connects to the refinements service, parses the response into a model
Retrieves at most 10,000 refinements for the navigation specified.
query - A query representing the search.navigationName - The name of the navigation to get more refinements for.java.io.IOExceptionpublic java.lang.String getBridgeRefinementsUrl()
protected RefinementsResult mapRefinements(java.io.InputStream data, boolean returnBinary)
public void shutdown()
Cleanup HTTP connection pool.
public void setRetryTimeout(long retryTimeout)
Sets the retry timeout for a failed request.
retryTimeout - the retry timeoutCopyright © 2013–2016 GroupBy Inc.. All rights reserved.