setDescending method is not working query level
MY VIEW: I want to get documents with sorting lastmodified date for that i've wrote view here
com.couchbase.lite.View viewTicketsPerStatusPagination = database.getView(String.format("%s/%s", D_DOCNAME, TICKETS_PER_STATUS_PAGINATION));
viewTicketsPerStatusPagination.setMap(new Mapper() {
@Override
public void map(Map<String, Object> document, Emitter emitter) {
Object type = document.get(TYPE);
String archived = (String) document.get(ARCHIVED);
try {
if (type != null && DOCTYPE_TICKET.equals(type) && archived == null) {
emitter.emit(new Object[]{document.get(PROJECT),((HashMap<String, String>) document.get(DATES)).get(LASTMODIFIEDDATE)},
Utility.getInstance().parsingTicket(document));
}
} catch (NullPointerException e) {
}
}
}, "3.3");
}
My Query:
com.couchbase.lite.View listMaps = AppConstants.database.getView(String.format("%s/%s", D_DOCNAME, TICKETS_PER_STATUS_PAGINATION));
Query queryGetGroupNames = listMaps.createQuery().toLiveQuery();
queryGetGroupNames.setStartKey(new Object[]{AppConstants.project_id});
queryGetGroupNames.setEndKey(new Object[]{AppConstants.project_id, new HashMap<String, Object>()});
queryGetGroupNames.setDescending(true)// this is not working
queryGetGroupNames.setLimit(20);
queryGetGroupNames.setSkip(0);
QueryEnumerator result = null;
try {
result = queryGetGroupNames.run();
} catch (CouchbaseLiteException ex) {
}
for (Iterator<QueryRow> it = result; it.hasNext(); ) {
QueryRow row = it.next();
Alert.getInstance().callLog("Ticket Documet information " + row.getValue());
}
Note:If setDescending(false) query is giving some of result but i want to do like setdescending(true) but query not giving any results even not showing any log information.
How we can solve this problem? or any suggestions.
Thank's in advance
Thank's
Prasanna