thanks a lot

but i have another same question

when i want to search some text in all my note(the text property of note 
NOT the name of note) and group the result by the "name property" and look 
like the before question i want to know the count  of each group what to do?
in sql something like this : 
select count(*),name from notes when text like '%cat%' group by name;
my code like this:


NSString *text = @"cat";

CBLView* view = [database viewNamed: @"fullTextSearch_on_note"];

    if (!view.mapBlock) {

        [view setMapBlock: MAPBLOCK({

            if ([doc[@"doc_type"] isEqualToString: @"note"]) {

                id date = [doc objectForKey: @"created_at"];

                NSString* body = doc[@"text"];

                //emit(body,@[date,doc]);

                emit(CBLTextKey(body),@[doc["name"],date]);

            }

        }) reduceBlock: REDUCEBLOCK({

            return @(values.count);

        })

            version: @"5"]; // bump version any time you change the 
MAPBLOCK body!

    }

    


    CBLQuery* query = [view createQuery];

    query.fullTextQuery = text;

    query.groupLevel = 1;


    NSError *err;


    CBLQueryEnumerator *allDocument = [query run:&err];


but the row of allDocument is zero (no result)

-- 
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/4cb2a2e7-f5e5-4d21-89ea-9e0473d02187%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to