Re: how to sum values of a view in a date range?

2011-06-09 Thread David Hardtke
Hi Fabio, This should work. You can use the _sum builtin as reduce: "reduce":"_sum" You then need to query your view with the proper group level and a startkey and endkey: GET db/_design/power/_view/watt?group_level=2&startkey=[2011,3]&endkey=[2011,4]&inclusive_end=false That gives you t

Re: View advice

2011-04-08 Thread David Hardtke
sting FWIW. Didn't know that was possible... Does that let you specify startkey/endkey instead of key? On Apr 8, 2011, at 11:27 AM, David Hardtke wrote: You can send multiple keys to the view if you use POST: POST /db/_design/ddoc/_view/name?reduce=true/false -d '{"queries&

Re: View advice

2011-04-08 Thread David Hardtke
You can send multiple keys to the view if you use POST: POST /db/_design/ddoc/_view/name?reduce=true/false -d '{"queries":[{"key":"NY"},{"key","CA"}]}' You'll still need to remove duplicates and merge the two views for the two keys. On 04/08/11 04:39, Daniel ItaboraĆ­ wrote: I would love t

Re: Full text search - is it coming? If yes, approx when.

2011-03-29 Thread David Hardtke
Hi All, If we're discussing a native CouchDB full text search, I'd like to point out a few things about Cloudant's implementation that might guide the design. Our search indexing strategy is discussed here: http://support.cloudant.com/kb/search/search-indexing What we've opted to do is borr

Re: Couchdb - how to search within field or fields?

2011-03-23 Thread David Hardtke
No. For logical queries you need a search add-on: couchdb-lucene: http://github.com/rnewson/couchdb-lucene ElasticSearch: http://www.elasticsearch.com/ Cloudant Search (hosted): http://blog.cloudant.com/developer-preview-cloudant-search-for-couchdb/ On 03/23/11 15:56, Andrew Stuart (SuperCod

Re: View for multiple IDs

2011-02-24 Thread David Hardtke
You don't need a view for this. You can use the bulk document API to fetch multiple documents with a single request: http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API On 02/24/11 05:26, Justin Walgran wrote: You definitely want to POST the keys to the view. Looping over the entire view

Re: Doubts with multiple keys!

2011-01-21 Thread David Hardtke
Hi Fabio, I'm assuming the your "value" is the document that you want to retrieve. There is no need to include the document in the view result directly. Your value can be null. When you retrieve the view you can add include_docs=true to the query and it will append the document to your res

Re: Writing View to Get Unique Values in Arrays Across Documents

2011-01-19 Thread David Hardtke
The format won't be exact, but you could use an array for a key: map: function(doc) { for (var i = doc.arrayData) { emit([doc.idToRetrieveBy, doc.arrayData[i]], null) } } reduce: _count (i.e. the builtin) you can then run the following query for idToRetrieveBy=1 GET /dbname/_