You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by cd...@free.fr on 2010/09/20 13:27:05 UTC

Muti-View support : feedback,issues, and question



Hi,

We successfully installed the multiview couchdb from the git, and there seems to be some issues with the tests demonstrating the mutiview features.

1/ Issue #1 : muti view demonstration test is not available from Futon

We can see it is included in the tests ( file share/couchdb/www/script/couch_tests.js ), but not shown in Futon.

This can be fixed by copying the multiview.js file in the share/couchdb/www/script/tests directory on install time.

Adding the file in the share/Makefile.am should fix the build process.


2/ Issue #2 : the test fails

When we finally add it the test fails with the following errors :

1.Assertion failed : results.row
2.Assertion failed : results.row

The log is pretty verbose (with debug level), but basicaly there seems to be a 400 error when views URL is queried.

Here is an extract of the log, full log is attached (and gzipped) :

[Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.155.0>] httpd 400 error response:
 {"error":"bad_request","reason":"Only reserved document ids may start with underscore."}

[Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] 'POST' /test_suite_db/_multi {1,1}
Headers: [{'Accept',"application/json"},
          {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"},
          {'Accept-Encoding',"gzip,deflate"},
          {'Accept-Language',"en-us,en;q=0.5"},
          {'Cache-Control',"no-cache"},
          {'Connection',"keep-alive"},
          {'Content-Length',"52"},
          {'Content-Type',"application/json; charset=UTF-8"},
          {'Host',"127.0.0.1:5985"},
          {'Keep-Alive',"115"},
          {'Pragma',"no-cache"},
          {'Referer',"http://127.0.0.1:5985/_utils/couch_tests.html?script/couch_tests.js"},
          {'User-Agent',"Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10"}]
[Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] OAuth Params: []
[Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] Minor error in HTTP request: {bad_request,
                                 <<"Only reserved document ids may start with underscore.">>}
[Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] Stacktrace: [{couch_doc,validate_docid,1},
             {couch_httpd_db,db_doc_req,3},
             {couch_httpd_db,do_db_req,2},
             {couch_httpd,handle_request_int,5},
             {mochiweb_http,headers,5},
             {proc_lib,init_p_do_apply,3}]


3/ The demo test script is not clear

Our understanding is that this feature returns  an intersection (on docid) from several view queries. At least this is what we read on the mailing list.

However, it is not cleat at all how keys are sent to the distinct views. Especially, how can we use the multi view and send different keys for the different views.

Let's say that :

we have a view using  doc creation date as a key
another view using doc author as  key

We would like to get all the documents created by a particular author for a given time range, how do we provide the appropriate key.

A clear example would really be appreciated because currently, there are no keys provided in  the js example code.

( BTW we know that this particular example can be resolved using collation, however it seemed the simplest example we can find for the multi view criteria selection ).

Regards,

cdrx


Re: Muti-View support : feedback,issues, and question

Posted by cd...@free.fr.
Hi,

Thanks for your answer,
>
> thanks for testing this out, this looks like a configuration issue,
> _multi should be a registered httpd_db_handler in local.ini as
> follows.
>
> [httpd_db_handlers]
> _multi = {multiview_httpd, handle_request}
>
> I will look into this and make sure it gets added.

I'll try to change the config on our side and give it a try.
>
> In the test scripts the following code
>
>     var ddocThree = {
>       _id:"_design/three",
>       views: {
>         "test" : {map: "function (doc) {if (doc.integer % 3 == 0)
> emit(doc.integer, null)};"}
>       }
>     };
>
> is emitting keys with the doc._id as an integer, in this case for
> multiples of 3, the second view ddocFour is emitting the documents
> with keys that are multiples of 4.
>
> Hence when we do a multiview and find the intersections of these two
> views we get the documents whose id (as integer keys) are multiples of
> 12.
Actually I did understand what the example does ;).

However what I'd like to know if it is possible to pass parameters (keys, ranges)  to the "called views" map functions ( in this example views "test" in _design/three and _design/four ) ?

Something like : return all documents which id is a multiple of N _and_ ,  for instance , is created in a given time range (assuming we have a creation date field in the doc).

Is this case covered by the multiview feature ?


Regards,

cdrx

Re: Muti-View support : feedback,issues, and question

Posted by Norman Barker <no...@gmail.com>.
Hi,

thanks for testing this out, this looks like a configuration issue,
_multi should be a registered httpd_db_handler in local.ini as
follows.

[httpd_db_handlers]
_multi = {multiview_httpd, handle_request}

I will look into this and make sure it gets added.

In the test scripts the following code

    var ddocThree = {
      _id:"_design/three",
      views: {
        "test" : {map: "function (doc) {if (doc.integer % 3 == 0)
emit(doc.integer, null)};"}
      }
    };

is emitting keys with the doc._id as an integer, in this case for
multiples of 3, the second view ddocFour is emitting the documents
with keys that are multiples of 4.

Hence when we do a multiview and find the intersections of these two
views we get the documents whose id (as integer keys) are multiples of
12.

Norman

On Mon, Sep 20, 2010 at 5:27 AM,  <cd...@free.fr> wrote:
>
>
>
> Hi,
>
> We successfully installed the multiview couchdb from the git, and there seems to be some issues with the tests demonstrating the mutiview features.
>
> 1/ Issue #1 : muti view demonstration test is not available from Futon
>
> We can see it is included in the tests ( file share/couchdb/www/script/couch_tests.js ), but not shown in Futon.
>
> This can be fixed by copying the multiview.js file in the share/couchdb/www/script/tests directory on install time.
>
> Adding the file in the share/Makefile.am should fix the build process.
>
>
> 2/ Issue #2 : the test fails
>
> When we finally add it the test fails with the following errors :
>
> 1.Assertion failed : results.row
> 2.Assertion failed : results.row
>
> The log is pretty verbose (with debug level), but basicaly there seems to be a 400 error when views URL is queried.
>
> Here is an extract of the log, full log is attached (and gzipped) :
>
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.155.0>] httpd 400 error response:
>  {"error":"bad_request","reason":"Only reserved document ids may start with underscore."}
>
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] 'POST' /test_suite_db/_multi {1,1}
> Headers: [{'Accept',"application/json"},
>          {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"},
>          {'Accept-Encoding',"gzip,deflate"},
>          {'Accept-Language',"en-us,en;q=0.5"},
>          {'Cache-Control',"no-cache"},
>          {'Connection',"keep-alive"},
>          {'Content-Length',"52"},
>          {'Content-Type',"application/json; charset=UTF-8"},
>          {'Host',"127.0.0.1:5985"},
>          {'Keep-Alive',"115"},
>          {'Pragma',"no-cache"},
>          {'Referer',"http://127.0.0.1:5985/_utils/couch_tests.html?script/couch_tests.js"},
>          {'User-Agent',"Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10"}]
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] OAuth Params: []
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] Minor error in HTTP request: {bad_request,
>                                 <<"Only reserved document ids may start with underscore.">>}
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] Stacktrace: [{couch_doc,validate_docid,1},
>             {couch_httpd_db,db_doc_req,3},
>             {couch_httpd_db,do_db_req,2},
>             {couch_httpd,handle_request_int,5},
>             {mochiweb_http,headers,5},
>             {proc_lib,init_p_do_apply,3}]
>
>
> 3/ The demo test script is not clear
>
> Our understanding is that this feature returns  an intersection (on docid) from several view queries. At least this is what we read on the mailing list.
>
> However, it is not cleat at all how keys are sent to the distinct views. Especially, how can we use the multi view and send different keys for the different views.
>
> Let's say that :
>
> we have a view using  doc creation date as a key
> another view using doc author as  key
>
> We would like to get all the documents created by a particular author for a given time range, how do we provide the appropriate key.
>
> A clear example would really be appreciated because currently, there are no keys provided in  the js example code.
>
> ( BTW we know that this particular example can be resolved using collation, however it seemed the simplest example we can find for the multi view criteria selection ).
>
> Regards,
>
> cdrx
>
>

Re: Muti-View support : feedback,issues, and question

Posted by Norman Barker <no...@gmail.com>.
Hi,

thanks for testing this out, this looks like a configuration issue,
_multi should be a registered httpd_db_handler in local.ini as
follows.

[httpd_db_handlers]
_multi = {multiview_httpd, handle_request}

I will look into this and make sure it gets added.

In the test scripts the following code

    var ddocThree = {
      _id:"_design/three",
      views: {
        "test" : {map: "function (doc) {if (doc.integer % 3 == 0)
emit(doc.integer, null)};"}
      }
    };

is emitting keys with the doc._id as an integer, in this case for
multiples of 3, the second view ddocFour is emitting the documents
with keys that are multiples of 4.

Hence when we do a multiview and find the intersections of these two
views we get the documents whose id (as integer keys) are multiples of
12.

Norman

On Mon, Sep 20, 2010 at 5:27 AM,  <cd...@free.fr> wrote:
>
>
>
> Hi,
>
> We successfully installed the multiview couchdb from the git, and there seems to be some issues with the tests demonstrating the mutiview features.
>
> 1/ Issue #1 : muti view demonstration test is not available from Futon
>
> We can see it is included in the tests ( file share/couchdb/www/script/couch_tests.js ), but not shown in Futon.
>
> This can be fixed by copying the multiview.js file in the share/couchdb/www/script/tests directory on install time.
>
> Adding the file in the share/Makefile.am should fix the build process.
>
>
> 2/ Issue #2 : the test fails
>
> When we finally add it the test fails with the following errors :
>
> 1.Assertion failed : results.row
> 2.Assertion failed : results.row
>
> The log is pretty verbose (with debug level), but basicaly there seems to be a 400 error when views URL is queried.
>
> Here is an extract of the log, full log is attached (and gzipped) :
>
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.155.0>] httpd 400 error response:
>  {"error":"bad_request","reason":"Only reserved document ids may start with underscore."}
>
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] 'POST' /test_suite_db/_multi {1,1}
> Headers: [{'Accept',"application/json"},
>          {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"},
>          {'Accept-Encoding',"gzip,deflate"},
>          {'Accept-Language',"en-us,en;q=0.5"},
>          {'Cache-Control',"no-cache"},
>          {'Connection',"keep-alive"},
>          {'Content-Length',"52"},
>          {'Content-Type',"application/json; charset=UTF-8"},
>          {'Host',"127.0.0.1:5985"},
>          {'Keep-Alive',"115"},
>          {'Pragma',"no-cache"},
>          {'Referer',"http://127.0.0.1:5985/_utils/couch_tests.html?script/couch_tests.js"},
>          {'User-Agent',"Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10"}]
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] OAuth Params: []
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] Minor error in HTTP request: {bad_request,
>                                 <<"Only reserved document ids may start with underscore.">>}
> [Mon, 20 Sep 2010 11:01:46 GMT] [debug] [<0.599.0>] Stacktrace: [{couch_doc,validate_docid,1},
>             {couch_httpd_db,db_doc_req,3},
>             {couch_httpd_db,do_db_req,2},
>             {couch_httpd,handle_request_int,5},
>             {mochiweb_http,headers,5},
>             {proc_lib,init_p_do_apply,3}]
>
>
> 3/ The demo test script is not clear
>
> Our understanding is that this feature returns  an intersection (on docid) from several view queries. At least this is what we read on the mailing list.
>
> However, it is not cleat at all how keys are sent to the distinct views. Especially, how can we use the multi view and send different keys for the different views.
>
> Let's say that :
>
> we have a view using  doc creation date as a key
> another view using doc author as  key
>
> We would like to get all the documents created by a particular author for a given time range, how do we provide the appropriate key.
>
> A clear example would really be appreciated because currently, there are no keys provided in  the js example code.
>
> ( BTW we know that this particular example can be resolved using collation, however it seemed the simplest example we can find for the multi view criteria selection ).
>
> Regards,
>
> cdrx
>
>