[英]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.