Striped queries
---------------

                 Key: COUCHDB-244
                 URL: https://issues.apache.org/jira/browse/COUCHDB-244
             Project: CouchDB
          Issue Type: New Feature
          Components: Database Core
            Reporter: Frederik Fix
         Attachments: striped_queries.diff

I have implemented striped queries, where you can specify multiple 
startkey/endkey ranges in a single request. As a nice side effect this allows 
faceted search (for discrete keys). Heres an example:

Say I have the following map function:

function() {
  emit([doc.rooms, doc.price], doc);
}

where doc.rooms and doc.price are both integers. Now lets say i want to find 
every document with a number of rooms between 2 and 4 and a price between 100 
and 1000. I can then do the following query:

db.view("my_view",{},{stripes: [{startkey: [2, 100], endkey: [2, 1000]}, 
{startkey: [3, 100], endkey: [3, 1000]}, {startkey: [4, 100], endkey: [4, 
1000]}]});

If the view included a reduce function that would work too.


As you can probably see this patch introduced a change to the JS API (but not 
the HTTP). The keys parameter is now a hash which can either take a keys param 
or a stripes. The keys param works as before. The stripes param takes an array 
of hashes each having a startkey, endkey key.


The state of the patch is still somewhat raw, with no error checking on the 
stripes part of the API. Furthermore it might be useful to extend the limit, 
skip and descending options to the stripes.

The patch is against the current trunk version (rev 742925) and all tests pass.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to