![](/img/trans.png)
[英]When using Solrj with Basic auth, giving me error "Caused by: java.net.SocketException: Connection reset"
[英]SOLRJ giving me strange error when trying to add a pdf to a new core. "You must type correct path"
所以开始将古老的 solr 应用程序更新到 9.1 以及 SolrJ 索引器。 当我尝试添加文档时,我在线程“主”org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException 中出现异常:http 处的服务器出错://my.host:8983/solr/qmap :正在搜索对于 Solr 你必须输入正确的路径 Solr 会回复
我可以在 solr 管理员和 solr 中看到 qmap 核心正在运行。
代码是:
public class DocumentIndexer {
private final String fileToIndex;
private final ConcurrentUpdateHttp2SolrClient solrClient;
private final Http2SolrClient http2Client;
public DocumentIndexer(String solrUrl, String fileToIndex) {
this.fileToIndex =fileToIndex;
http2Client = new Http2SolrClient.Builder().build();
solrClient = new ConcurrentUpdateHttp2SolrClient.Builder(solrUrl, http2Client).build();
}
public void indexDocuments() throws IOException, SolrServerException{
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");
req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
req.addFile(new File(fileToIndex),"application/xml");
req.setParam("id", fileToIndex);
req.process(solrClient);
solrClient.commit(true, true);
}
}
足够简单 - 更新/提取未在 solrconfig 中定义。 使用 sample_techproducts_examples 作为模板重新创建核心,或者使用定义的更新/提取路径设置 solrconfig。
另外,req.setParam("id", fileToIndex) 需要改为 req.setParam("literal.id", fileToIndex)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.