【发布时间】:2017-11-20 09:09:02
【问题描述】:
我使用 solr 7.1.0,我想在查询中获取 tf、idf 值,因此发送查询:
http://192.168.0.127:8983/solr/law/select?fl=tf(content,2005)&q=*:*&wt=xml
但是,我遇到了一个例外:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<bool name="zkConnected">true</bool>
<int name="status">500</int>
<int name="QTime">12</int>
<lst name="params">
<str name="q">*:*</str>
<str name="fl">tf(content, 2005)</str>
<str name="wt">xml</str>
<str name="_">1511167922616</str>
</lst>
</lst>
<lst name="error">
<lst name="metadata">
<str name="error-class">org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException</str>
<str name="root-error-class">org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException</str>
</lst>
<str name="msg">Error from server at http://192.168.0.127:8983/solr/law_shard2_replica_n2: Server Error
request: http://192.168.0.127:8983/solr/law_shard2_replica_n2/select</str>
<str name="trace">org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://192.168.0.127:8983/solr/law_shard2_replica_n2: Server Error
request: http://192.168.0.127:8983/solr/law_shard2_replica_n2/select
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:626)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:253)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:242)
at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1219)
at org.apache.solr.handler.component.HttpShardHandler.lambda$submit$0(HttpShardHandler.java:172)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176)
at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:188)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
</str>
<int name="code">500</int>
</lst>
</response>
是否需要将某些 jar 库复制到 libs 目录?还是我错过了什么?
顺便说一句,docfreq 和 termfreq 正在工作。
【问题讨论】:
-
检查 Solr 的服务器端日志以获取实际错误 - 但请尝试
tf(content, '2005')- 即在您正在查找的术语周围加上引号(..因为这就是它在文档中的使用方式至少,但 Solr 通常接受这两种形式..) -
日志显示实际异常:2017-11-20 09:48:57.810 错误 (qtp947679291-18) [c:law s:shard2 r:core_node4 x:law_shard2_replica_n2] o.a.s.s.HttpSolrCall null:java .lang.UnsupportedOperationException: requires a TFIDFSimilarity (例如 ClassicSimilarity) 我使用 bin/solr -c 启动一个 solrcloud 服务,在 configsets/_default/config/managed-schema 中设置
之后,我仍然得到这个异常。
标签: solr