couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan Lehnardt (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-1868) Using multiple keys, the _all_docs built-in view acts differently then a user defined view
Date Mon, 12 Aug 2013 18:06:49 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-1868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13737127#comment-13737127
] 

Jan Lehnardt commented on COUCHDB-1868:
---------------------------------------

[~dedalo] I totally get why returning null rows is a nice convenience :)

My reasoning is this:

1. _all_docs should behave like regular views if at all possible.
2. Regular views do not send empty rows when requested with multiple keys (in fact, in terms
of ranges, that can be an unbounded result, so we need to be careful here that this only applies
to POST {keys:[...]} and maybe other caveats)
3. I haven’t looked at the code, but I assume the easiest thing to do is remove the null-rows
code from _all_docs, rather than adding sending null-rows to regular views. Hence, the minimum
thing we should do to achieve behaviour parity is remove null-rows from all docs (or make
it optional with a query parameter).
4. If anyone feels like sitting down allowing both _all_docs and regular views to have null-rows
off by default and on-by-query-parameter, that is what I think we should go for, but I am
happy to get parity by sacrificing null-rows on just _all_docs as a first step.


                
> Using multiple keys, the _all_docs built-in view acts differently then a user defined
view
> ------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-1868
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1868
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Filippo Fadda
>
> When you query a view using multiple keys, the _all_docs built-in view acts differently
then a user defined view:
> 1) in the first case CouchDB returns "not_found" for every not found key;
> 2) querying a user defined view produces, instead, an empty array.
> In the first case you obtain error="not_found" for every key, when you query a user defined
view you simply don't get any rows, just the total rows for the view.
> See: http://pastebin.com/D7NExJrd
> Now, regarding 'keys' the documentation says something like: "Used to retrieve just the
view rows matching that set of keys. Rows are returned in the order of the specified keys."
> In a normal case, CouchDB should return just a row for each matched key, but it will
really help, having an option to return a row for every key, even there if not found, because
it's more easy, cycle through results.
> Let's suppose the application I'm doing gets the last 30 blog posts, displaying for each
one, information that are stored into related documents. The application will query, using
as keys the posts' identifiers, other views to get, for example, if a post has been starred
from the current logged-in user, etc.
> If a view always returns a number of rows equals to the number of keys, the application
can cycle from 0 to 29 and display all the related information for a post.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message