您好我正在尝试使用spring boot data solr索引solr中的实体。但我得到了例外
Caused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/portal: Expected mime type application/octet-stream but got text/html. <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/portal/publishers/update. Reason:
<pre> Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>
</body>
</html>
这是我的发布商类
@SolrDocument
public class Publishers {
@Id
@Field
private String advID;
@Field
private String name;
@Field
private String domain;
@Field("cat")
private String categories;
//getters and setters
}
我的存储库界面
public interface BookRepository extends SolrCrudRepository<Publishers, String> {
List<Publishers> findByName(String name);
}
我的基本网址为"http://localhost:8983/solr/portal"
。在我的主类代码中如下
@Resource
BookRepository repository;
@Override
public void run(String... strings) throws Exception {
this.repository.save(new Publishers("4", "Sony Playstation","none", null));
}
已更新
我观察到实体类即Publishers
名称会自动附加到URL。我不知道如何告诉应用程序在向solr发送呼叫时不要在solr URL中附加名称。
谁能帮我。提前致谢
答案 0 :(得分:0)
您应该将Solr文档注释为@SolrDocument(solrCoreName =“ YOU_CORE_NAME”)
答案 1 :(得分:-3)
检查您的网址是否正确无误。