incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcello Nuccio <marcello.nuc...@gmail.com>
Subject Re: get view with a list of keys
Date Wed, 18 Jan 2012 11:01:09 GMT
I'm not sure to follow...

1. are you sure the GET does work? When I try, the key[] parameters are ignored.

2. IMHO the advantage of GET is cache-ability. Building a JSON is quite easy:
    JSON.stringify({ keys: [ "key1", "key2" ] });

Can you give some more information?

Thanks,
  Marcello

2012/1/18 CGS <cgsmcmlxxv@gmail.com>:
> The problem with POST method is that you need to do the encoding manually,
> while with GET method instead of &key=["key1",...], you get
> &key[]=["key1"]&key[]=... To solve the problem, for example, I transform
> the full query in a string and I attach it manually to the web address. In
> that way, the browser takes care of encoding for me and I avoid the mess. I
> use this method under jQuery AJAX (don't forget to add \" for the double
> quota required in the query).
>
> Hope it will help.
>
> CGS
>
>
>
>
>
> On Wed, Jan 18, 2012 at 11:29 AM, Marcello Nuccio <marcello.nuccio@gmail.com
>> wrote:
>
>> Yes, but you need to do a POST, not a GET:
>>
>> http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options
>>
>> put the following JSON in the body:
>> {"keys": ["key1", "key2", ...]}
>>
>> Marcello
>>
>> 2012/1/18 Alexandre Masselot <alexandre.masselot@gmail.com>:
>> > Hello,
>> >
>> > I'm using view with a simple map that extract a couple of values (we
>> store
>> > millions of web page info in couchdb and I need to access rapidly a md5
>> > field to know whether we should treat a crawled page or if we already
>> know
>> > it).
>> >
>> > It's fine to get the view output for one page
>> > http://127.0.0.1:5984/honbot/_design/projections/_view/md5?key=
>> > "http%253A%252F%252Fwww.gesunde-maenner.ch%252Fhtml%252F"
>> >
>> >
>> > For saving, we use bulk_docs to save doc per 1000 slices and that goes
>> much
>> > faster.
>> >
>> > My question is: is it possible to make a view request list above, but
>> with
>> > a list of key?
>> > Let's say
>> > "http%253A%252F%252Fwww.gesunde-maenner.ch%252Fhtml%252F"
>> >  and "http%253A%252F%252Fwww.pipo.com"
>> >
>> >
>> > thanks for the help
>> > alex
>> > --
>> > Alexandre Masselot
>> >
>> > http://alexandre-masselot.blogspot.com/
>>

Mime
View raw message