空间视图因function_clause错误而失败

时间:2015-09-21 19:15:37

标签: couchdb ubuntu-14.10 geocouch

我不想使用GeoCouch,但似乎我无法正确设置

设置:

  • Ubuntu 14.10

  • CouchDB 1.6.1,源自

  • GeoCouch:我无法在自述文件中指示的newvtree分支构建它,因此我尝试使用this gist中的couchdb1.3.x分支(+评论)适应1.6.1

数据来自here,并使用此设计文档传递给数据库:

{
   "_id": "_design/geotest",
   "_rev": "7-6e930896b441ace3dc1d46ff1dd4f09e",
   "language": "javascript",
   "spatial": {
       "points": "function(doc){ if (doc.latitude && doc.longitude){emit([doc.latitude, doc.longitude], null)}}"
   }
}

curl $DB/_design/geotest/_spatial/points?bbox=46,16,48.2,16.4给了我一个Empty reply from server,而这就是日志中显示的内容:

[Mon, 21 Sep 2015 18:55:12 GMT] [info] [<0.32.0>] Apache CouchDB has started on http://0.0.0.0:5984/
[Mon, 21 Sep 2015 18:57:40 GMT] [info] [<0.304.0>] Opening index for db: geoexample idx: _design/geotest sig: "ad4c001590440653d6856cc41edf57d5"
[Mon, 21 Sep 2015 18:57:40 GMT] [info] [<0.308.0>] Starting index update for db: geoexample idx: _design/geotest
[Mon, 21 Sep 2015 18:57:41 GMT] [error] [emulator] Error in process <0.314.0> with exit value: {function_clause,[{couch_spatial_updater,process_result,[[[3.317463e+01,-1.173577e+02],null]],[{file,"src/geocouch/couch_spatial_updater.erl"},{line,286}]},{couch_spatial_updater,'-merge_results/3-lc$^1/1-1-',1,[{file,"src/geocouch/couch_sp... 


[Mon, 21 Sep 2015 18:57:41 GMT] [error] [<0.120.0>] {error_report,<0.31.0>,
                     {<0.120.0>,crash_report,
                      [[{initial_call,
                         {mochiweb_acceptor,init,
                          ['Argument__1','Argument__2','Argument__3']}},
                        {pid,<0.120.0>},
                        {registered_name,[]},
                        {error_info,
                         {error,badarg,
                          [{erlang,list_to_binary,
                            [[{couch_spatial_updater,process_result,
                               [[[33.174628,-117.357673],null]],
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,286}]},
                              {couch_spatial_updater,
                               '-merge_results/3-lc$^1/1-1-',1,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,189}]},
                              {couch_spatial_updater,
                               '-merge_results/3-lc$^0/1-0-',1,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,189}]},
                              {couch_spatial_updater,merge_results,3,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,189}]},
                              {lists,foldl,3,[{file,"lists.erl"},{line,1261}]},
                              {couch_spatial_updater,merge_results,4,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,180}]},
                              {couch_spatial_updater,write_results,2,
                               [{file,
                                 "src/geocouch/couch_spatial_updater.erl"},
                                {line,155}]}]],
                            []},
                           {couch_httpd,error_info,1,
                            [{file,"couch_httpd.erl"},{line,818}]},
                           {couch_httpd,send_error,2,
                            [{file,"couch_httpd.erl"},{line,925}]},
                           {couch_httpd,handle_request_int,5,
                            [{file,"couch_httpd.erl"},{line,353}]},
                           {mochiweb_http,headers,5,
                            [{file,"mochiweb_http.erl"},{line,94}]},
                           {proc_lib,init_p_do_apply,3,
                            [{file,"proc_lib.erl"},{line,239}]}]}},
                        {ancestors,
                         [couch_httpd,couch_secondary_services,
                          couch_server_sup,<0.32.0>]},
                        {messages,[]},
                        {links,[<0.104.0>,#Port<0.2715>]},
                        {dictionary,
                         [{mochiweb_request_qs,[{"bbox","46,16,48.2,16.4"}]},
                          {couch_rewrite_count,0},
                          {mochiweb_request_cookie,[]}]},
                        {trap_exit,false},
                        {status,running},
                        {heap_size,6772},
                        {stack_size,27},
                        {reductions,6588}],
                       []]}}

我尝试了这种设置的变体,但是the closest answer I found related to this kind of error邀请安装一个甚至在Apache镜像上停止使用的CouchDB版本,而显然有些人确实使GeoCouch与CouchDB 1.6.1一起工作,{{3}所以我想这只是我做错了什么,但是什么?!?提前感谢任何线索

1 个答案:

答案 0 :(得分:0)

如果使用couchdb1.3.x分支,则需要发出GeoJSON几何体。所以在你的情况下:

emit({“type”:“Point”,“coordinates”:[doc.longitude,doc.latitude]},null);