public class CollectionSearchResource
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected OrchestrateClient |
client
The Orchestrate client to make requests with.
|
protected JacksonMapper |
jacksonMapper |
protected com.fasterxml.jackson.databind.ObjectMapper |
mapper
The object mapper used to deserialize JSON responses.
|
| Modifier and Type | Method and Description |
|---|---|
<T> OrchestrateRequest<SearchResults<T>> |
get(java.lang.Class<T> clazz,
java.lang.String luceneQuery)
Retrieve data from the Orchestrate service.
|
CollectionSearchResource |
limit(int limit)
The number of search results to get in this query, this value cannot
exceed 100.
|
CollectionSearchResource |
offset(int offset)
The position in the results list to start retrieving results from,
this is useful for paginating results.
|
CollectionSearchResource |
sort(java.lang.String sortFields)
Apply sorting to the results in the search query, this will render the
relevancy value in the "score" field for the results to be "0.0".
|
protected byte[] |
toJsonBytes(java.lang.Object value) |
protected com.fasterxml.jackson.databind.JsonNode |
toJsonNode(org.glassfish.grizzly.http.HttpContent response) |
protected <T> KvObject<T> |
toKvObject(org.glassfish.grizzly.http.HttpContent response,
java.lang.String collection,
java.lang.String key,
java.lang.Class<T> clazz) |
protected <T> KvObject<T> |
toKvObject(com.fasterxml.jackson.databind.JsonNode result,
java.lang.Class<T> clazz) |
CollectionSearchResource |
withValues(boolean withValues)
If
withValues is true then the KV objects in the search
results will be retrieved with their values. |
protected final OrchestrateClient client
protected final com.fasterxml.jackson.databind.ObjectMapper mapper
protected final JacksonMapper jacksonMapper
public <T> OrchestrateRequest<SearchResults<T>> get(java.lang.Class<T> clazz, java.lang.String luceneQuery)
Usage:
String luceneQuery = "*";
SearchResults<String> results1 =
client.searchCollection("someCollection")
.limit(10)
.offset(0)
.sort("value.name.last:asc")
.get(String.class, luceneQuery)
.get();
T - The type toclazz - Type information for marshalling objects at runtime.luceneQuery - The lucene search query.public CollectionSearchResource limit(int limit)
limit - The number of search results in this query.public CollectionSearchResource offset(int offset)
offset - The position to start retrieving results from.public CollectionSearchResource sort(java.lang.String sortFields)
client.searchCollection("someCollection")
.sort("value.name.last:asc,value.name.first:asc")
.get(String.class, "*")
.get()
sortFields - The comma separated field names to sort by.public CollectionSearchResource withValues(boolean withValues)
withValues is true then the KV objects in the search
results will be retrieved with their values. Defaults to true.withValues - The setting for whether to retrieve KV values.protected byte[] toJsonBytes(java.lang.Object value)
protected com.fasterxml.jackson.databind.JsonNode toJsonNode(org.glassfish.grizzly.http.HttpContent response)
throws java.io.IOException
java.io.IOExceptionprotected <T> KvObject<T> toKvObject(com.fasterxml.jackson.databind.JsonNode result, java.lang.Class<T> clazz) throws java.io.IOException
java.io.IOExceptionprotected <T> KvObject<T> toKvObject(org.glassfish.grizzly.http.HttpContent response, java.lang.String collection, java.lang.String key, java.lang.Class<T> clazz) throws java.io.IOException
java.io.IOException