You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Ronny Pfannschmidt (JIRA)" <ji...@apache.org> on 2012/06/18 15:44:43 UTC

[jira] [Created] (COUCHDB-1498) range_prefix view parameter to ease working with ranges

Ronny Pfannschmidt created COUCHDB-1498:
-------------------------------------------

             Summary: range_prefix view parameter to ease working with ranges
                 Key: COUCHDB-1498
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1498
             Project: CouchDB
          Issue Type: Bug
          Components: View Server Support
            Reporter: Ronny Pfannschmidt


queries for certain ranges are a common operation,
but we are usually left with figuring what kind of start/end key combination to use if we want a certain range

it would be really pleasant if instead of constructing a start/end range from a prefix by guessing mostly how to construct the end param,
we could just pass the range prefix as a string/array to the view

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

        

[jira] [Commented] (COUCHDB-1498) range_prefix view parameter to ease working with ranges

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

Ronny Pfannschmidt commented on COUCHDB-1498:
---------------------------------------------

the main issue is - that from what i gathered - all wrong key prefixes are used out there, to supposedly mean what i want to archieve
i suppose its reasonable to assume to do this only for one level of nesting (only work for string key and array key, don’t consider partial of the last item(

i still would like to propose both variants, 

keyprefix would be strict, and consider only items in the toplevel sequence (so it would work for strings and arrays and solve most simple cases)
rangeprefix would recurse on the last item of the sequence if it is a array or string

but im under the impression that the rangeprefix idea is a bit too complicated and may cause grief in the long run
                
> range_prefix view parameter to ease working with ranges
> -------------------------------------------------------
>
>                 Key: COUCHDB-1498
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1498
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Ronny Pfannschmidt
>
> queries for certain ranges are a common operation,
> but we are usually left with figuring what kind of start/end key combination to use if we want a certain range
> it would be really pleasant if instead of constructing a start/end range from a prefix by guessing mostly how to construct the end param,
> we could just pass the range prefix as a string/array to the view

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

       

[jira] [Closed] (COUCHDB-1498) range_prefix view parameter to ease working with ranges

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

Paul Joseph Davis closed COUCHDB-1498.
--------------------------------------

    Resolution: Won't Fix

I agree with Bob that this isn't going to be much better than just trying to be better at explaining collation.
                
> range_prefix view parameter to ease working with ranges
> -------------------------------------------------------
>
>                 Key: COUCHDB-1498
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1498
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Ronny Pfannschmidt
>
> queries for certain ranges are a common operation,
> but we are usually left with figuring what kind of start/end key combination to use if we want a certain range
> it would be really pleasant if instead of constructing a start/end range from a prefix by guessing mostly how to construct the end param,
> we could just pass the range prefix as a string/array to the view

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

        

[jira] [Commented] (COUCHDB-1498) range_prefix view parameter to ease working with ranges

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

Ronny Pfannschmidt commented on COUCHDB-1498:
---------------------------------------------

a first example would be finding ddocs 

current way startkey="_design/" endkey= "_desigm"  or "design/\u9999" 
rage way would be range_prefix="design/"

another examples would be something like get articles of a month/year

current way startkey=[year, month] endkey=[year, month, {}]
range way would be range_prefix=[year, month]


last example would be multiple string parts

if one had with various values foremit(['something', 'another'], null)

and would like to get anything that "starts with" ["something", "anot"]

current way startkey=["something", "anot"], endkey=["something", "anotZZZ"]
range way would be range_prefix=["something", "anot"]

as a sidenote, it seems that this kind of prefix handling makes only sense for strings, arrays, and last strings of an array


                
> range_prefix view parameter to ease working with ranges
> -------------------------------------------------------
>
>                 Key: COUCHDB-1498
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1498
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Ronny Pfannschmidt
>
> queries for certain ranges are a common operation,
> but we are usually left with figuring what kind of start/end key combination to use if we want a certain range
> it would be really pleasant if instead of constructing a start/end range from a prefix by guessing mostly how to construct the end param,
> we could just pass the range prefix as a string/array to the view

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

        

[jira] [Commented] (COUCHDB-1498) range_prefix view parameter to ease working with ranges

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

Robert Newson commented on COUCHDB-1498:
----------------------------------------

I want to close this as "Won't Fix". Can I get a second from a committer?
                
> range_prefix view parameter to ease working with ranges
> -------------------------------------------------------
>
>                 Key: COUCHDB-1498
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1498
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Ronny Pfannschmidt
>
> queries for certain ranges are a common operation,
> but we are usually left with figuring what kind of start/end key combination to use if we want a certain range
> it would be really pleasant if instead of constructing a start/end range from a prefix by guessing mostly how to construct the end param,
> we could just pass the range prefix as a string/array to the view

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

        

[jira] [Commented] (COUCHDB-1498) range_prefix view parameter to ease working with ranges

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

Robert Newson commented on COUCHDB-1498:
----------------------------------------

Those are the kinds of thing I thought you meant and, for me, they fail my point 1 in that the values chosen for startkey/endkey will depend on the types of the supplied range_prefix value. This is surprising and potentially very confusing.

I'll note, since you raised them, that none of the startkey/endkey examples are quite right.

Futon find design documents using startkey="_design/"&endkey="_design0" since design documents, by definition, occupy a namespace delimited by / and 0 is the next character up from there.

The assumption that empty object is the intended endkey in your second example is questionable and the assumption that Z is the last letter of the alphabet is false.

I'd like to hear from other developers but I don't in general see a solid heuristic for guessing correct startkey and endkey values from a prefix value. While it seems intuitive in the cases Ronny mentions, the devil, as always, is in the details.

To end on a more positive note, I would suggest this as the least surprising, but still useful enhancement;

?keyprefix=["foo"]

This will *only* work for array keys and will not guess partially completed items. The above query will find ["foo"], ["foo", 12], ["foo", {"foo":"bar"}], ["foo", bar"], etc (but not ["goo"], or ["food"]).



                
> range_prefix view parameter to ease working with ranges
> -------------------------------------------------------
>
>                 Key: COUCHDB-1498
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1498
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Ronny Pfannschmidt
>
> queries for certain ranges are a common operation,
> but we are usually left with figuring what kind of start/end key combination to use if we want a certain range
> it would be really pleasant if instead of constructing a start/end range from a prefix by guessing mostly how to construct the end param,
> we could just pass the range prefix as a string/array to the view

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

        

[jira] [Commented] (COUCHDB-1498) range_prefix view parameter to ease working with ranges

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

Robert Newson commented on COUCHDB-1498:
----------------------------------------

Included to close as 'won't fix' but I'll give it more time to see if someone can justify this addition.

If you don't know the range you want then I don't see how 'range_prefix' can help, and if you do know the range you want, you by definition know the startkey and endkey values.

Provide some examples of this new API that would improve usability without a) potentially being the wrong answer and b) being easier to figure out that startkey/endkey.

                
> range_prefix view parameter to ease working with ranges
> -------------------------------------------------------
>
>                 Key: COUCHDB-1498
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1498
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Ronny Pfannschmidt
>
> queries for certain ranges are a common operation,
> but we are usually left with figuring what kind of start/end key combination to use if we want a certain range
> it would be really pleasant if instead of constructing a start/end range from a prefix by guessing mostly how to construct the end param,
> we could just pass the range prefix as a string/array to the view

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