Hi @PRASANNA KUMAR,

What version of Couchbase LIte for Android? If you are using 1.0.x, I would 
like to recommend to upgrade to v1.1.0 which contains performance 
improvement for indexing.

Does you JSON data contains non-ascii characters? If so, it makes indexing 
slower. We plan to work for this, but not scheduled it yet.

Thanks,
Hideki

On Wednesday, August 19, 2015 at 5:36:25 AM UTC-7, PRASANNA KUMAR wrote:
>
> Hi All,
>
> I would to know about how we can do the sorting technique using one view 
> and query. Right now i'm having 3 types sorting technique(
> *LastModifiedDate*,*DueDate,ResponsibleEmailID*)  i do not like write 
> three view and queries. I want to finish in one view and query itself all 
> three sorting techniques.
> I will share here how is did till the time,
>
> 1) This for sort by lastmodified date
>
> //create view for get all ticket document per project
> com.couchbase.lite.View viewTicketsPerProjectPagination = 
> database.getView(String.format("%s/%s", D_DOCNAME, 
> TICKETS_PER_PROJECT_PAGINATION));
> viewTicketsPerProjectPagination.setMap(new Mapper() {
>     @Override
>     public void map(Map<String, Object> document, Emitter emitter) {
>
>         Object type = document.get(TYPE);
>         String archivedState;
>         try {
>             archivedState = (String) document.get(ARCHIVED) != null ? 
> ARCHIVED : UNARCHIVED;
>         }catch (Exception ex){
>             archivedState = UNARCHIVED;
>         }
>         try {
>             if (type != null && DOCTYPE_TICKET.equals(type)) {
>                 emitter.emit(new 
> Object[]{document.get(PROJECT),archivedState,((HashMap<String, String>) 
> document.get(DATES)).get(LASTMODIFIEDDATE)}, null);
>             }
>         } catch (NullPointerException e) {
>         }
>     }
> }, "5.5");
>
>
> 2)This is for dueDate
>
>
> //create view for get Tickets for selected map document in project  by using 
> status As Per DueDate
> com.couchbase.lite.View viewTicketsPerMapPaginationByStatusAsPerDueDate = 
> database.getView(String.format("%s/%s", D_DOCNAME, 
> TICKET_PER_MAP_BY_STATUS_AS_PER_DUE_DATE));
> viewTicketsPerMapPaginationByStatusAsPerDueDate.setMap(new Mapper() {
>     @Override
>     public void map(Map<String, Object> document, Emitter emitter) {
>
>         Object type = document.get(TYPE);
>         String archivedState;
>         try {
>             archivedState = (String) document.get(ARCHIVED) != null ? 
> ARCHIVED : UNARCHIVED;
>         }catch (Exception ex){
>             archivedState = UNARCHIVED;
>         }
>
>         try {
>             if (type != null && DOCTYPE_TICKET.equals(type)) {
>                 emitter.emit(new Object[]{document.get(PROJECT), 
> document.get(MAP), ((HashMap<String, String>) 
> document.get(STATE)).get(STATE), archivedState,((HashMap<String, String>) 
> document.get(PLAN)).get(DUEDATE)},
>                         null);
>             }
>         } catch (NullPointerException e) {
>         }
>     }
> }, "1.4");
>
>
> 3) This is for sort by responsible emailId
>
>
> //create view for get all ticket document per project As Per Reponsible
> com.couchbase.lite.View viewTicketsPerProjectPaginationAsPerReponsible = 
> database.getView(String.format("%s/%s", D_DOCNAME, 
> TICKETS_PER_PROJECT_PAGINATION_AS_PER_RESPONSIBLE));
> viewTicketsPerProjectPaginationAsPerReponsible.setMap(new Mapper() {
>     @Override
>     public void map(Map<String, Object> document, Emitter emitter) {
>
>         Object type = document.get(TYPE);
>         String archivedState;
>         Object sortObject;
>         try {
>             archivedState = (String) document.get(ARCHIVED) != null ? 
> ARCHIVED : UNARCHIVED;
>         }catch (Exception ex){
>             archivedState = UNARCHIVED;
>         }
>         try{
>             sortObject = ((HashMap<Object, HashMap<Object, String>>) 
> document.get(PARTICIPANTS)).
>                     get(RESPONSIBLE).get(EMAIL);
>         }catch (Exception ex){
>             sortObject = null;
>         }
>
>         try {
>             if (type != null && DOCTYPE_TICKET.equals(type)) {
>                 emitter.emit(new Object[]{document.get(PROJECT), 
> archivedState,sortObject},
>                         null);
>             }
>         } catch (NullPointerException e) {
>         }
>     }
> }, "2.9");
>
>
> But those are causing the performance because of lot other thinks are there 
> to write view and query, so that inmy project contains more view and query i 
> would to reduce those many thinks.
>
>
> How we can reduce those many views ? is there any api's to write direct 
> sorting thinks supported by CBL API's 
>
>
> Please let me know if you need any other information i can provide you  
>
>
> Thank's
>
> prasanna
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/d3db9952-db8e-4b4d-a481-dabecfc8f398%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to