Solr MoreLikeThis /mlt handler returns a 404 error

2019-05-23 08:51发布

问题:

I want to find all the documents that is similar to a specific document within solr. I have installed solr and made some queries. The query I am trying to make gives an error which I cannot make out or research on the internet. Can you give me some light on this? I am using solrnet client but if solrnet is not appropriate for this type of query I will gladly use pure solr and read the XML.

Here is the query I am using:

http://192.168.1.10:8080/solr/mlt?q=id:12&mlt.fl=content&mlt.mindf=1&mlt.mintf=1

here is my schema xml here

 <fields>
  <field name="id" type="string" indexed="true" stored="true" />
  <field name="title" type="string" indexed="true" stored="false"/>
  <field name="content" type="text_general" indexed="true" stored="false"/>
 </fields>

Here is the error I am receiving:

回答1:

It seems you haven't registered the MLT handler in solrconfig.xml. A simple registration looks like this:

<requestHandler name="/mlt" class="org.apache.solr.handler.MoreLikeThisHandler"/>