我在使用Solr 4.2.0的“ / terms”请求处理程序中遇到困难。
使用网络浏览器,以下网址返回fieldName INDUSTRY的术语列表
http://localhost:8983/solr/collection1/terms?terms.fl=INDUSTRY&terms.prefix=P&terms=true
Run Code Online (Sandbox Code Playgroud)
另一方面,以下查询不返回任何条件:
http://localhost:8983/solr/collection1/select?qt=terms&terms.fl=INDUSTRY&terms.prefix=P&terms=true
Run Code Online (Sandbox Code Playgroud)
我的问题是如何通过“ / select” requestHandler使用“ / terms” requestHandler?
Solr的日志如下(如果对您有帮助)
Apr 12, 2013 10:21:55 AM org.apache.solr.core.SolrCore execute
INFO: [collection1] webapp=/solr path=/terms params={terms.fl=INDUSTRY&terms=true&terms.prefix=P} status=0 QTime=5
Apr 12, 2013 10:22:09 AM org.apache.solr.core.SolrCore execute
INFO: [collection1] webapp=/solr path=/select params={terms.fl=INDUSTRY&terms=true&qt=terms&terms.prefix=P} hits=0 status=0 QTime=0
Run Code Online (Sandbox Code Playgroud)
以下步骤解决了上述问题。
首先,在 solrconfig.xml 中,您应该删除“/select”requestHandler,并将 handleSelect 设置为 true。
<requestDispatcher handleSelect="true" >
Run Code Online (Sandbox Code Playgroud)
其次,重新启动 Solr,以下查询将起作用:
http://localhost:8983/solr/collection1/select?qt=/terms&terms.fl=INDUSTRY&terms.prefix=P&terms=true
Run Code Online (Sandbox Code Playgroud)
重要提示:请注意 qt 参数上的“/terms”,使用“qt=terms”将不起作用。