簡體   English   中英

solrconfig.xml中的更改后,SolrJ中的異常

[英]Exception in SolrJ after change in solrconfig.xml

所以 這是我的第一個問題,請客氣;)

我一直在與Solr合作,最近發現它 幾乎 根本沒有安全性。因此,在瀏覽器中,您可以編寫http://HOST:PORT/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true並輕松刪除我的索引。

閱讀Solr Wiki,我編輯了solrconfig.xml文件,添加了自己的RequestHandler進行更新。

<requestHandler name="/theupdate" 
   class="solr.XmlUpdateRequestHandler">
</requestHandler>

..而不是默認值。

<requestHandler name="/update" 
   class="solr.XmlUpdateRequestHandler">
</requestHandler>

現在我在向服務器添加文檔集合時(提交之前)遇到了此異常。

org.apache.solr.client.solrj.SolrServerException: Server at http://HOST:PORT/solr returned non ok status:400, message:Missing solr core name in path
  at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:328)
  at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:211)
  at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105)
  at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:69)
  at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)

這是我的索引代碼:

SolrServer server = new HttpSolrServer("http://HOST:PORT/solr");
Collection<SolrInputDocument> colection = new ArrayList<SolrInputDocument>();
SolrInputDocument solrDoc = new SolrInputDocument();
OracleCachedRowSet rsX = getDataFromDB(); // not actual line
while (rsX.next()) {
  solrDoc.addField("id", rsX.getLong(1), 1.0f);
  solrDoc.addField("name", rsX.getString(2), 1.0f);
  colection.add(solrDoc);
}
server.add(colection); //<-- the exception is thrown here!
server.commit();
colection.clear();

注意:我也讀過一些有關通過servlet容器中的防火牆和/或基本身份驗證來保護Solr的知識,我也正在研究...

提前致謝!

我一直在尋找通過上可用的方法HttpSolrServer和各種add的方法SolrServer在SolrJ庫,不幸的是,我沒有看到,你可以覆蓋或SolrJ為updateHandler指定一個不同名稱的任何地方。 假定它將通過http://HOST:PORT/solr/update

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM