public class ViewQuery
extends java.lang.Object
Fluent DSL for a View Query.
Modifier and Type | Method and Description |
---|---|
ViewQuery |
debug()
Enabled debugging on view queries.
|
ViewQuery |
debug(boolean debug) |
ViewQuery |
descending()
Return the documents in descending by key order.
|
ViewQuery |
descending(boolean desc) |
ViewQuery |
development() |
ViewQuery |
development(boolean development) |
protected java.lang.String |
encode(java.lang.String source)
Helper method to properly encode a string.
|
ViewQuery |
endKey(boolean key) |
ViewQuery |
endKey(double key) |
ViewQuery |
endKey(int key) |
ViewQuery |
endKey(JsonArray key) |
ViewQuery |
endKey(JsonObject key) |
ViewQuery |
endKey(long key) |
ViewQuery |
endKey(java.lang.String key) |
ViewQuery |
endKeyDocId(java.lang.String id) |
static ViewQuery |
from(java.lang.String design,
java.lang.String view)
Creates an new
ViewQuery . |
java.lang.String |
getDesign() |
java.lang.String |
getView() |
ViewQuery |
group()
Group the results using the reduce function to a group or single row.
|
ViewQuery |
group(boolean group) |
ViewQuery |
groupLevel(int grouplevel)
Specify the group level to be used.
|
ViewQuery |
inclusiveEnd()
Specifies whether the specified end key should be included in the result.
|
ViewQuery |
inclusiveEnd(boolean inclusive) |
boolean |
isDevelopment() |
ViewQuery |
key(boolean key) |
ViewQuery |
key(double key) |
ViewQuery |
key(int key) |
ViewQuery |
key(JsonArray key) |
ViewQuery |
key(JsonObject key) |
ViewQuery |
key(long key) |
ViewQuery |
key(java.lang.String key) |
ViewQuery |
keys(JsonArray keys) |
ViewQuery |
limit(int limit)
Limit the number of the returned documents to the specified number.
|
ViewQuery |
onError(OnError onError)
Sets the response in the event of an error.
|
ViewQuery |
reduce() |
ViewQuery |
reduce(boolean reduce)
Explicitly enable/disable the reduce function on the query.
|
ViewQuery |
skip(int skip)
Skip this number of records before starting to return the results.
|
ViewQuery |
stale(Stale stale)
Allow the results from a stale view to be used.
|
ViewQuery |
startKey(boolean key) |
ViewQuery |
startKey(double key) |
ViewQuery |
startKey(int key) |
ViewQuery |
startKey(JsonArray key) |
ViewQuery |
startKey(JsonObject key) |
ViewQuery |
startKey(long key) |
ViewQuery |
startKey(java.lang.String key) |
ViewQuery |
startKeyDocId(java.lang.String id) |
java.lang.String |
toString() |
public static ViewQuery from(java.lang.String design, java.lang.String view)
Creates an new ViewQuery
.
design
- the name of the design document.view
- the name of the view.ViewQuery
DSL.public ViewQuery development()
public ViewQuery development(boolean development)
public ViewQuery reduce(boolean reduce)
Explicitly enable/disable the reduce function on the query.
reduce
- if reduce should be enabled or not.Query
object for proper chaining.public ViewQuery reduce()
public ViewQuery limit(int limit)
Limit the number of the returned documents to the specified number.
limit
- the number of documents to return.Query
object for proper chaining.public ViewQuery group()
Group the results using the reduce function to a group or single row.
Important: this setter and groupLevel(int)
should not be used together in the same Query
. It is sufficient to only set the grouping level only and use this setter in cases where you always want the highest group level implictly.
Query
object for proper chaining.public ViewQuery group(boolean group)
public ViewQuery groupLevel(int grouplevel)
Specify the group level to be used.
Important: group()
and this setter should not be used together in the same Query
. It is sufficient to only use this setter and use group()
in cases where you always want the highest group level implictly.
grouplevel
- How deep the grouping level should be.Query
object for proper chaining.public ViewQuery inclusiveEnd()
Specifies whether the specified end key should be included in the result.
Query
object for proper chaining.public ViewQuery inclusiveEnd(boolean inclusive)
public ViewQuery skip(int skip)
Skip this number of records before starting to return the results.
skip
- The number of records to skip.Query
object for proper chaining.public ViewQuery stale(Stale stale)
Allow the results from a stale view to be used.
See the “Stale” enum for more information on the possible options. The default setting is “update_after”!
stale
- Which stale mode should be used.Query
object for proper chaining.public ViewQuery onError(OnError onError)
Sets the response in the event of an error.
See the “OnError” enum for more details on the available options.
onError
- The appropriate error handling type.Query
object for proper chaining.public ViewQuery debug()
Enabled debugging on view queries.
Query
object for proper chaining.public ViewQuery debug(boolean debug)
public ViewQuery descending()
Return the documents in descending by key order.
Query
object for proper chaining.public ViewQuery descending(boolean desc)
public ViewQuery key(java.lang.String key)
public ViewQuery key(int key)
public ViewQuery key(long key)
public ViewQuery key(double key)
public ViewQuery key(boolean key)
public ViewQuery key(JsonObject key)
public ViewQuery startKeyDocId(java.lang.String id)
public ViewQuery endKeyDocId(java.lang.String id)
public ViewQuery endKey(java.lang.String key)
public ViewQuery endKey(int key)
public ViewQuery endKey(long key)
public ViewQuery endKey(double key)
public ViewQuery endKey(boolean key)
public ViewQuery endKey(JsonObject key)
public ViewQuery startKey(java.lang.String key)
public ViewQuery startKey(int key)
public ViewQuery startKey(long key)
public ViewQuery startKey(double key)
public ViewQuery startKey(boolean key)
public ViewQuery startKey(JsonObject key)
protected java.lang.String encode(java.lang.String source)
Helper method to properly encode a string.
This method can be overridden if a different encoding logic needs to be used.
source
- source string.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getDesign()
public java.lang.String getView()
public boolean isDevelopment()