org.ektorp
Class ViewQuery

java.lang.Object
  extended by org.ektorp.ViewQuery

public class ViewQuery
extends java.lang.Object

Author:
henrik lundgren

Constructor Summary
ViewQuery()
           
 
Method Summary
 java.lang.String buildQuery()
           
 ViewQuery dbPath(java.lang.String s)
           
 ViewQuery descending(boolean b)
          View rows are sorted by the key; specifying descending=true will reverse their order.
 ViewQuery designDocId(java.lang.String s)
           
 ViewQuery endDocId(java.lang.String s)
           
 ViewQuery endKey(java.lang.String s)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getEndKey()
           
 java.lang.String getKey()
           
 java.lang.String getStartKey()
           
 ViewQuery group(boolean b)
          The group option controls whether the reduce function reduces to a set of distinct keys or to a single result row.
 ViewQuery groupLevel(int i)
           
 int hashCode()
           
 ViewQuery includeDocs(boolean b)
          The include_docs option will include the associated document.
 ViewQuery inclusiveEnd(boolean b)
          The inclusive_end option controls whether the endkey is included in the result.
 ViewQuery key(java.lang.String s)
           
 ViewQuery limit(int i)
          limit=0 you don't get any data, but all meta-data for this View.
 ViewQuery reduce(boolean b)
          If a view contains both a map and reduce function, querying that view will by default return the result of the reduce function.
 void reset()
          Resets internal state so this builder can be used again.
 ViewQuery skip(int i)
          The skip option should only be used with small values, as skipping a large range of documents this way is inefficient (it scans the index from the startkey and then skips N elements, but still needs to read all the index values to do that).
 ViewQuery staleOk(boolean b)
          The stale option can be used for higher performance at the cost of possibly not seeing the all latest data.
 ViewQuery startDocId(java.lang.String s)
           
 ViewQuery startKey(java.lang.String s)
           
 ViewQuery viewName(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewQuery

public ViewQuery()
Method Detail

dbPath

public ViewQuery dbPath(java.lang.String s)

designDocId

public ViewQuery designDocId(java.lang.String s)

viewName

public ViewQuery viewName(java.lang.String s)

key

public ViewQuery key(java.lang.String s)
Parameters:
need - to be properly JSON encoded values (for example, key="string" for a string value).
Returns:

startKey

public ViewQuery startKey(java.lang.String s)
Parameters:
need - to be properly JSON encoded values (for example, startkey="string" for a string value).
Returns:

startDocId

public ViewQuery startDocId(java.lang.String s)

endKey

public ViewQuery endKey(java.lang.String s)
Parameters:
need - to be properly JSON encoded values (for example, endkey="string" for a string value).
Returns:

endDocId

public ViewQuery endDocId(java.lang.String s)

limit

public ViewQuery limit(int i)
limit=0 you don't get any data, but all meta-data for this View. The number of documents in this View for example.

Parameters:
i -
Returns:

staleOk

public ViewQuery staleOk(boolean b)
The stale option can be used for higher performance at the cost of possibly not seeing the all latest data. If you set the stale option to ok, CouchDB may not perform any refreshing on the view that may be necessary.

Parameters:
b -
Returns:

descending

public ViewQuery descending(boolean b)
View rows are sorted by the key; specifying descending=true will reverse their order. Note that the descending option is applied before any key filtering, so you may need to swap the values of the startkey and endkey options to get the expected results.

Parameters:
b -
Returns:

skip

public ViewQuery skip(int i)
The skip option should only be used with small values, as skipping a large range of documents this way is inefficient (it scans the index from the startkey and then skips N elements, but still needs to read all the index values to do that). For efficient paging you'll need to use startkey and limit. If you expect to have multiple documents emit identical keys, you'll need to use startkey_docid in addition to startkey to paginate correctly. The reason is that startkey alone will no longer be sufficient to uniquely identify a row.

Parameters:
i -
Returns:

group

public ViewQuery group(boolean b)
The group option controls whether the reduce function reduces to a set of distinct keys or to a single result row.

Parameters:
b -
Returns:

groupLevel

public ViewQuery groupLevel(int i)

reduce

public ViewQuery reduce(boolean b)
If a view contains both a map and reduce function, querying that view will by default return the result of the reduce function. The result of the map function only may be retrieved by passing reduce=false as a query parameter.

Parameters:
b -
Returns:

includeDocs

public ViewQuery includeDocs(boolean b)
The include_docs option will include the associated document. Although, the user should keep in mind that there is a race condition when using this option. It is possible that between reading the view data and fetching the corresponding document that the document has changed. If you want to alleviate such concerns you should emit an object with a _rev attribute as in emit(key, {"_rev": doc._rev}). This alleviates the race condition but leaves the possiblity that the returned document has been deleted (in which case, it includes the "_deleted": true attribute).

Parameters:
b -
Returns:

inclusiveEnd

public ViewQuery inclusiveEnd(boolean b)
The inclusive_end option controls whether the endkey is included in the result. It defaults to true.

Parameters:
b -
Returns:

reset

public void reset()
Resets internal state so this builder can be used again.


getKey

public java.lang.String getKey()

getStartKey

public java.lang.String getStartKey()

getEndKey

public java.lang.String getEndKey()

buildQuery

public java.lang.String buildQuery()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2010. All Rights Reserved.