在fl参数中使用tf func得到异常

时间:2017-11-20 09:09:03

标签: solr

我使用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正在发挥作用。

1 个答案:

答案 0 :(得分:1)

this is the answer,将以下内容添加到schema.xml或managed-schema(solr cloud)中。

<similarity class="solr.ClassicSimilarityFactory"/>

BM25Similarity不是TFIDFSimilarity的子类,所以solr.BM25SimilarityFactory不正确。

谢谢MatsLindh