|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.couchbase.client.protocol.views.Query
public class Query
The Query class allows custom view-queries to the Couchbase cluster. The Query class supports all arguments that can be passed along with a Couchbase view query. For example, this makes it possible to change the sorting order, query only a range of keys or include the full docs. By default, the full docs are not included and no reduce job is executed. Here is a short example on how to use the Query object - for more information on the allowed arguments see the corresponding setter method. // Run the reduce phase as well: Query query = new Query(); query.setReduce(true); // Include the full docs: Query query = new Query(); query.setIncludeDocs(true);
Constructor Summary | |
---|---|
Query()
Creates a new Query object with default settings. |
Method Summary | |
---|---|
Query |
copy()
Creates a new query instance and returns it with the properties bound to the current object. |
java.util.Map<java.lang.String,java.lang.Object> |
getArgs()
Returns all current args for proper inspection. |
int |
getLimit()
Returns the currently set limit. |
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 opt)
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(java.lang.Boolean reduce)
Use the reduction function. |
Query |
setSkip(int docstoskip)
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 object as a string, suitable for the HTTP queries. |
boolean |
willIncludeDocs()
Read if full documents will be included on the query. |
boolean |
willReduce()
Read if reduce is enabled or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Query()
Method Detail |
---|
public boolean willReduce()
public boolean willIncludeDocs()
public Query setDescending(boolean descending)
descending
- True if the sort-order should be descending.
public Query setEndkeyDocID(java.lang.String endkeydocid)
endkeydocid
- The document ID that should be used.
public Query setGroup(boolean group)
group
- True when grouping should be enabled.
public Query setGroupLevel(int grouplevel)
grouplevel
- How deep the grouping level should be.
public Query setIncludeDocs(boolean include)
include
- True when the full docs should be included in the result.
public Query setInclusiveEnd(boolean inclusiveend)
inclusiveend
- True when the key should be included.
public Query setKey(ComplexKey key)
key
- The document key.
public Query setKey(java.lang.String key)
key
- The document key.
public Query setKeys(ComplexKey keys)
keys
- The document keys.
public Query setKeys(java.lang.String keys)
keys
- The document keys.
public Query setLimit(int limit)
limit
- The number of documents to return.
public int getLimit()
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.
public Query setRange(ComplexKey startkey, ComplexKey endkey)
startkey
- The start of the key range.endkey
- The end of the key range.
public Query setRangeStart(java.lang.String startkey)
startkey
- The start of the key range.
public Query setRangeStart(ComplexKey startkey)
startkey
- The start of the key range.
public Query setReduce(java.lang.Boolean reduce)
reduce
- True if the reduce phase should also be executed.
public Query setRangeEnd(java.lang.String endkey)
endkey
- The end of the key range.
public Query setRangeEnd(ComplexKey endkey)
endkey
- The end of the key range.
public Query setSkip(int docstoskip)
docstoskip
- The number of records to skip.
public Query setStale(Stale stale)
stale
- Which stale mode should be used.
public Query setStartkeyDocID(java.lang.String startkeydocid)
startkeydocid
- The document ID to match.
public Query setOnError(OnError opt)
opt
- The appropriate error handling type.
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 Query setDebug(boolean debug)
debug
- True when debugging should be enabled.
public Query copy()
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Map<java.lang.String,java.lang.Object> getArgs()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |