[英]SolrJ error when adding data
我正在嘗試以Java編程方式啟動Solr服務器,並且正在使用官方教程中的資源。 我的代碼是:
String urlString = "http://localhost:8983/solr";
SolrClient solr = new HttpSolrClient(urlString);
SolrInputDocument document = new SolrInputDocument();
document.addField("id", "552199");
document.addField("name", "Gouda cheese wheel");
document.addField("price", "49.99");
UpdateResponse response = solr.add(document);
solr.commit();
問題是我無法以編程方式啟動服務器(通過命令提示符來啟動服務器),並且出現以下錯誤:
Exception in thread "main" org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr: Expected mime type application/octet-stream but got text/html. <html>
知道發生了什么,如何解決?
字符串URL必須用Core指定。 如下
String urlString = "http://localhost:8983/solr/Core_name";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.