You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Nathan Stott (JIRA)" <ji...@apache.org> on 2009/10/08 19:10:31 UTC

[jira] Created: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: COUCHDB-523
                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
             Project: CouchDB
          Issue Type: Improvement
          Components: HTTP Interface
            Reporter: Nathan Stott
            Priority: Minor


It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.

The format could be as follows:

{ "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }



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


Re: [jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by Robert Newson <ro...@gmail.com>.
I like that. I do something like it in c-l where multiple queries can
be issued and the result becomes an array of responses.

B.

On Wed, Nov 3, 2010 at 10:52 AM, Adam Kocoloski (JIRA) <ji...@apache.org> wrote:
>
>    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12927868#action_12927868 ]
>
> Adam Kocoloski commented on COUCHDB-523:
> ----------------------------------------
>
> I've been thinking about this issue a bit and would like to propose an alternative syntax.  Instead of relying on overloading the "keys" field with things that are not really view keys, we could allow a new field called "queries" that looks like
>
> {"queries":[{"key":"foo"}, {"startkey":"bar", "endkey":"baz", "limit":10}, ...]}
>
> That is, each element of the queries Array would be a JSON Object specifying view query parameters.  Any parameters specified in the actual query string would be included as defaults.  CouchDB would execute the view requests serially and respond with an Array of view responses
>
> [
>  {"total_rows":100, "offset":34, "rows":[...]},
>  {"total_rows":100, "offset":20, "rows":[...]}
> ]
>
> The "keys" field and the "queries" field would be mutually exclusive.  The Objects in the queries Array would allow a user to specify any query-string parameter used with CouchDB views.  I'm not sure if _list functions would be supported.
>
> This feature is really a crutch to help HTTP clients that cannot avail themselves of advanced HTTP features such as pipelining.  I'm happy to add it, though, as that the set of clients which do support pipelining is not that large.
>
> What do you think?
>
>
>> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
>> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>>                 Key: COUCHDB-523
>>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>>             Project: CouchDB
>>          Issue Type: Improvement
>>          Components: HTTP Interface
>>            Reporter: Nathan Stott
>>            Assignee: Adam Kocoloski
>>            Priority: Minor
>>             Fix For: 1.1
>>
>>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>>
>>
>> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
>> The format could be as follows:
>> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

[jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12927982#action_12927982 ] 

Paul Joseph Davis commented on COUCHDB-523:
-------------------------------------------

I would say that Adam's array based approach is probably going to be more sensible as it allows people to more easily control the order in which the queries are processed in the case where someone wants to aggregate some sort of result across the multiple views.

For the response I think having a {"results": $array_of_results} wrapper is probably better as it allows for future changes more easily if we start annotating that response.

Just for fun, has anyone considered how this would integrate with _lists? Or if we people should be allowed to make queries on multiple views, and if so if they should or shouldn't be scoped to a design doc? 

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Assignee: Adam Kocoloski
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Walt W (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12856579#action_12856579 ] 

Walt W commented on COUCHDB-523:
--------------------------------

I don't actually have the time to test this at the moment, but I wanted to give this issue my vote and mention that this is a VERY useful feature . . . I'm not sure it should be included in a release without fixing the issue Jamie mentioned (grouping across different ranges), but if that could be fixed . . . this would be incredibly useful, and cut down on the space needed to make a bunch of different views to emulate this.

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Priority: Minor
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Jamie Talbot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849583#action_12849583 ] 

Jamie Talbot commented on COUCHDB-523:
--------------------------------------

I should mention that the supplied patch allows the setting of a group_level, but doesn't aggregate across the differing ranges. I.e. Say I had a blog and my "post count" view had a map to output "1" for every post and a reduce to sum those values, querying it with:

{
    "keys": [
        {
            "startkey": ["Category A","2010","03"],
            "endkey": ["Category A","2010","04",{}]
        },
        {
            "startkey": ["Category A","2010","06"],
            "endkey": ["Category A","2010","07",{}]
        }
    ]
}

using group=true&group_level=1

still gives me 2 rows:
Category A : 12
Category A : 14 

(for example).  Would be nice if it gave me one row of 26.

I think it's because the ranges are processed separately (more of a convenience than anything).  Someone more knowledgeable than me can correct me if I'm wrong.


> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Priority: Minor
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Jamie Talbot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848943#action_12848943 ] 

Jamie Talbot commented on COUCHDB-523:
--------------------------------------

I wanted this feature so much, I hacked up a version that appears to do it.  I'm nowhere near an Erlang or Couch expert, but it seems to do what I want and still be lightning fast so perhaps it is a solution.  The only changes were made to couch_httpd_view.erl.  General theory of operation is to pattern match start and end key fields from the Key variable in output_map_view and output_reduce_view.  I also had to list the restrictions on group_levels for multi-key documents seeing as they do make sense in this context.

Was pretty much scrambling in the dark, but If that sounds like a sensible approach, and someone can give me pointers on how to contribute, I'd be happy to attach it here. 

In the meantime, I'll attach my hacked up version of couch_http_view.erl.  I've also included a diff from version 0.10.1. 

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Priority: Minor
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Benjamin Anderson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886155#action_12886155 ] 

Benjamin Anderson commented on COUCHDB-523:
-------------------------------------------

This would be a big win for me as well, so I made a quick hack of the current trunk (1.1.0a961514) to enable it. It's pretty close to Jamie's work, except I didn't mess with the group_level code. Diff is attached.

My tests indicate that it works great, but they're admittedly limited; if there are any test suites out there that I can throw at it, let me know.

Similar to Jamie, I'm a novice with Erlang, but I'm a heavy Couch user and would like to get involved. If there's any change I can make to improve this, I'd be glad to spend the time on it.

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Priority: Minor
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Updated: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Jamie Talbot (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jamie Talbot updated COUCHDB-523:
---------------------------------

    Attachment: multi_start_end_key.diff
                couch_httpd_view.erl

Hacked version of couchdb_httpd_view.erl as of 0.10.1, to include multi start and end key functionality.

Also a diff from 0.10.1.

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Priority: Minor
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Nikita Nemkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849133#action_12849133 ] 

Nikita Nemkin commented on COUCHDB-523:
---------------------------------------

This is a very useful feature when indexing spatial data using z-order curve, hilbert curve etc. Queries to such indexes translate directly to a bunch of B-tree range queries (up to hundreds of ranges, depending on implementation).

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Priority: Minor
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Assigned: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Adam Kocoloski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Kocoloski reassigned COUCHDB-523:
--------------------------------------

    Assignee: Adam Kocoloski

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Assignee: Adam Kocoloski
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Anand Chitipothu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12927900#action_12927900 ] 

Anand Chitipothu commented on COUCHDB-523:
------------------------------------------


How about considering a dict instead of a list for queries? Keeping track of dictionary keys is much easier than keeping track of array indicies.

{
    "queries": {
        "foo": {"key":"foo"}, 
        "bar": {"startkey":"bar", "endkey":"baz", "limit":10}, 
        ...
    }
} 

And the response will be dictionary with same keys. 

{
    "results": {
        "foo": {"total_rows":100, "offset":34, "rows":[...]}, 
        "bar": {"total_rows":100, "offset":20, "rows":[...]} 
    }
}

I'm not very sure if introducing  another nested level "results" is required, but it looks symmetrical to the request.


> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Assignee: Adam Kocoloski
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Adam Kocoloski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12927976#action_12927976 ] 

Adam Kocoloski commented on COUCHDB-523:
----------------------------------------

Hi Anand, I'd like to see some of the other commenters weigh in on that one.  Personally I think it'd be a bit of a hassle to name each of my queries in a multi-query request.  I think I prefer the order-preserving behavior of an Array, where I could construct my queries Array in order and then just concatenate the rows from the individual responses.

I can say that implementing the API as you've written it is not much more difficult than the Array-based one.

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Assignee: Adam Kocoloski
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Updated: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Joseph Davis updated COUCHDB-523:
--------------------------------------

    Skill Level: Committers Level (Medium to Hard)

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Assignee: Adam Kocoloski
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Updated: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Adam Kocoloski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Kocoloski updated COUCHDB-523:
-----------------------------------

    Fix Version/s: 1.1

Seems pretty useful to me.  I think re-reducing the final output is not too hard if the key ranges do not overlap.  But what happens when they do?  I suppose a clever thing to do would be to merge the overlapping ranges, but that doesn't strike me as particularly relaxed.

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Commented: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Adam Kocoloski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12927868#action_12927868 ] 

Adam Kocoloski commented on COUCHDB-523:
----------------------------------------

I've been thinking about this issue a bit and would like to propose an alternative syntax.  Instead of relying on overloading the "keys" field with things that are not really view keys, we could allow a new field called "queries" that looks like

{"queries":[{"key":"foo"}, {"startkey":"bar", "endkey":"baz", "limit":10}, ...]}

That is, each element of the queries Array would be a JSON Object specifying view query parameters.  Any parameters specified in the actual query string would be included as defaults.  CouchDB would execute the view requests serially and respond with an Array of view responses

[
  {"total_rows":100, "offset":34, "rows":[...]},
  {"total_rows":100, "offset":20, "rows":[...]}
]

The "keys" field and the "queries" field would be mutually exclusive.  The Objects in the queries Array would allow a user to specify any query-string parameter used with CouchDB views.  I'm not sure if _list functions would be supported.

This feature is really a crutch to help HTTP clients that cannot avail themselves of advanced HTTP features such as pipelining.  I'm happy to add it, though, as that the set of clients which do support pipelining is not that large.

What do you think?


> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Assignee: Adam Kocoloski
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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


[jira] Updated: (COUCHDB-523) View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST

Posted by "Benjamin Anderson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Anderson updated COUCHDB-523:
--------------------------------------

    Attachment: ranged_key_post.diff

> View API POST keys to retrieve multiple docs by key could also allow for multiple 'range' queries, i.e. an array of { startkey: .., endkey: ... } params in the POST
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-523
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-523
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Nathan Stott
>            Priority: Minor
>         Attachments: couch_httpd_view.erl, multi_start_end_key.diff, ranged_key_post.diff
>
>
> It would be useful if I could do a single POST to a view to retrieve multiple ranges specified by startkey, endkey.
> The format could be as follows:
> { "ranges": [ { "startkey": "a", "endkey": "c" }, { "startkey":"g", "endkey":"z" } ] }

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