小编jbd*_*ask的帖子

将文档从AngularJS发布到SOLR 4


我对此深陷兔子洞.我正在创建一个简单的应用程序,它使用SOLR 4作为NoSQL数据存储区,使用AngularJS v1.2.2作为接口.我从命令行加载了一堆文件,AngularJS使搜索/查看这些文件变得非常容易.我想允许文档编辑,但无法使POST工作.Chrome控制台显示400个错误,"网络"标签显示OPTIONS方法失败.

网络标题:
Request URL:http://localhost:8983/solr/mrm_assay/update Request Method:OPTIONS Status Code:400 Bad Request Request Headers Accept:*/* Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8,es;q=0.6 Access-Control-Request-Headers:accept, content-type Access-Control-Request-Method:POST Cache-Control:no-cache Connection:keep-alive Host:localhost:8983 Origin:http://localhost:63342 Pragma:no-cache Referer:http://localhost:63342/angular-solr2/app/index.html User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36 Response Headers Access-Control-Allow-Credentials:true Access-Control-Allow-Headers:origin, content-type, cache-control, accept, options Access-Control-Allow-Methods:GET,POST,DELETE,PUT,HEAD,OPTIONS Access-Control-Allow-Origin:http://localhost:63342 Access-Control-Max-Age:1800 Content-Type:application/xml; charset=UTF-8 Transfer-Encoding:chunked

架构快速概述:
SOLR和AngularJS应用程序都在我的Mac上运行.SOLR使用默认的Jetty实例,Angular应用程序在WebStorm IDE的服务器内运行.CORS已启用,包括GET,POST,DELETE,PUT,HEAD,OPTIONS.

更新工作时:

  • 使用SOLR的仪表板
  • 使用命令行(示例)
    $ curl http://localhost:8983/solr/mrm_assay/update -H 'Content-type:application/json' -d '[ { "keep_in_assay" {"set" : "N", "detected_endog": "N", "problems_w_is": "removed b/c requires addition post-Oasis", "onc_std_set": …

rest solr http angularjs

5
推荐指数
1
解决办法
3149
查看次数

标签 统计

angularjs ×1

http ×1

rest ×1

solr ×1