public class Query
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
Query |
copy()
Copy the current
Query object into another one. |
protected java.lang.String |
encode(java.lang.String source)
Helper method to properly encode a string.
|
java.util.Map<java.lang.String,java.lang.Object> |
getArgs()
Helper method which collects all currently set arguments.
|
int |
getLimit()
Returns the currently set limit.
|
protected java.lang.String |
quote(java.lang.String source)
Helper method to properly quote the string if its a JSON string.
|
Query |
setBbox(double lowerLeftLong,
double lowerLeftLat,
double upperRightLong,
double upperRightLat)
Sets the params for a spatial bounding box view query.
|
Query |
setDebug(boolean debug)
Enabled debugging on view queries.
|
Query |
setDescending(boolean descending)
Return the documents in descending by key order.
|
Query |
setEndkeyDocID(java.lang.String endkeydocid)
Stop returning records when the specified document ID is reached.
|
Query |
setGroup(boolean group)
Group the results using the reduce function to a group or single row.
|
Query |
setGroupLevel(int grouplevel)
Specify the group level to be used.
|
Query |
setIncludeDocs(boolean include)
If the full documents should be included in the result.
|
Query |
setInclusiveEnd(boolean inclusiveend)
Specifies whether the specified end key should be included in the result.
|
Query |
setKey(ComplexKey key)
Return only documents that match the specified key.
|
Query |
setKey(java.lang.String key)
Return only documents that match the specified key.
|
Query |
setKeys(ComplexKey keys)
Return only documents that match each of keys specified within the given
array.
|
Query |
setKeys(java.lang.String keys)
Return only documents that match each of keys specified within the given
array.
|
Query |
setLimit(int limit)
Limit the number of the returned documents to the specified number.
|
Query |
setOnError(OnError onError)
Sets the response in the event of an error.
|
Query |
setRange(ComplexKey startkey,
ComplexKey endkey)
Returns records in the given key range.
|
Query |
setRange(java.lang.String startkey,
java.lang.String endkey)
Returns records in the given key range.
|
Query |
setRangeEnd(ComplexKey endkey)
Stop returning records when the specified key is reached.
|
Query |
setRangeEnd(java.lang.String endkey)
Stop returning records when the specified key is reached.
|
Query |
setRangeStart(ComplexKey startkey)
Return records with a value equal to or greater than the specified key.
|
Query |
setRangeStart(java.lang.String startkey)
Return records with a value equal to or greater than the specified key.
|
Query |
setReduce(boolean reduce)
Explicitly enable/disable the reduce function on the query.
|
Query |
setSkip(int skip)
Skip this number of records before starting to return the results.
|
Query |
setStale(Stale stale)
Allow the results from a stale view to be used.
|
Query |
setStartkeyDocID(java.lang.String startkeydocid)
Return records starting with the specified document ID.
|
java.lang.String |
toString()
Returns the
Query as a HTTP-compatible query string. |
boolean |
willIncludeDocs()
Read if full documents will be included on the query.
|
boolean |
willReduce()
Read if reduce is enabled or not.
|
public Query()
Query
.public Query setReduce(boolean reduce)
reduce
- if reduce should be enabled or not.Query
object for proper chaining.public Query setLimit(int limit)
limit
- the number of documents to return.Query
object for proper chaining.public Query setGroup(boolean group)
setGroupLevel(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.group
- True when grouping should be enabled.Query
object for proper chaining.public Query setGroupLevel(int grouplevel)
setGroup(boolean)
and this setter should not be used
together in the same Query
. It is sufficient to only use this
setter and use setGroup(boolean)
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 Query setIncludeDocs(boolean include)
include
- True when the full docs should be included in the result.Query
object for proper chaining.public Query setInclusiveEnd(boolean inclusiveend)
inclusiveend
- True when the key should be included.Query
object for proper chaining.public Query setSkip(int skip)
skip
- The number of records to skip.Query
object for proper chaining.public Query setStale(Stale stale)
stale
- Which stale mode should be used.Query
object for proper chaining.public Query setOnError(OnError onError)
onError
- The appropriate error handling type.Query
object for proper chaining.public Query setDebug(boolean debug)
debug
- True when debugging should be enabled.Query
object for proper chaining.public Query setDescending(boolean descending)
descending
- True if the sort-order should be descending.Query
object for proper chaining.public Query setKey(ComplexKey key)
key
- The document key.Query
object for proper chaining.public Query setKey(java.lang.String key)
key
- The document key.Query
object for proper chaining.public Query setKeys(ComplexKey keys)
keys
- The document keys.Query
object for proper chaining.public Query setKeys(java.lang.String keys)
keys
- The document keys.Query
object for proper chaining.public Query setStartkeyDocID(java.lang.String startkeydocid)
startkeydocid
- The document ID to match.Query
object for proper chaining.public Query setEndkeyDocID(java.lang.String endkeydocid)
endkeydocid
- The document ID that should be used.Query
object for proper chaining.public Query setRange(java.lang.String startkey, java.lang.String endkey)
startkey
- The start of the key range.endkey
- The end of the key range.Query
object for proper chaining.public Query setRange(ComplexKey startkey, ComplexKey endkey)
startkey
- The start of the key range.endkey
- The end of the key range.Query
object for proper chaining.public Query setRangeStart(java.lang.String startkey)
startkey
- The start of the key range.Query
object for proper chaining.public Query setRangeStart(ComplexKey startkey)
startkey
- The start of the key range.Query
object for proper chaining.public Query setRangeEnd(java.lang.String endkey)
endkey
- The end of the key range.Query
object for proper chaining.public Query setRangeEnd(ComplexKey endkey)
endkey
- The end of the key range.Query
object for proper chaining.public Query setBbox(double lowerLeftLong, double lowerLeftLat, double upperRightLong, double upperRightLat)
lowerLeftLong
- The longitude of the lower left corner.lowerLeftLat
- The latitude of the lower left corner.upperRightLong
- The longitude of the upper right corner.upperRightLat
- The latitude of the upper right corner.public boolean willReduce()
public boolean willIncludeDocs()
public int getLimit()
public java.lang.String toString()
Query
as a HTTP-compatible query string.toString
in class java.lang.Object
public java.util.Map<java.lang.String,java.lang.Object> getArgs()
protected java.lang.String encode(java.lang.String source)
source
- source string.protected java.lang.String quote(java.lang.String source)
source
- source string.Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.