0

I'm trying the MoreLikeThis feature of Solr using the following query in the browser:

http://localhost:8983/solr/gettingstarted_shard1_replica1/select?qt=mlt&q=id:31&mlt=true&mlt.fl=firstName,lastName&mlt.mindf=1&mlt.mintf=1&mlt.count=10

Which is working, but the response looks like the following:

<response>
<lst name="responseHeader">
         ... //removed for brevity
</lst>
<result name="response" numFound="1" start="0" maxScore="1.0">
   <doc>
      <str name="id">31</str>
      <str name="firstName">Alex Luis Armstrong</str>
      <str name="lastName">Major Wolf</str>
      <long name="_version_">1534338957920174080</long>
   </doc>
</result>
<lst name="moreLikeThis">
   <result name="31" numFound="4" start="0" maxScore="0.419522">
      <doc>
         <str name="id">32</str>
         <float name="score">0.419522</float>
      </doc>
      <doc>
         <str name="id">33</str>
         <float name="score">0.0254616</float>
      </doc>   
   </result>
</lst>
</response>

Why isn't firstName and lastName returned in the results for ids 32 and 33?

Fields types: enter image description here enter image description here enter image description here

Songo
  • 5,618
  • 8
  • 58
  • 96

2 Answers2

1

Actually I'm not sure about what's happening, but there are two places where I suggest to investigate.

  1. in your query string I see there is a parameter qt=mlt. The specified request handler or query type parameter (solrconfig.xml) can override your parameters. So I suggest to just remove the qt parameter and try to add mlt.match.include=true. This parameter specifies whether or not the response should include the matched document.
  2. the schema.xml, in particular I suggest to post the part where firstName and lastName are declared.
freedev
  • 25,946
  • 8
  • 108
  • 125
0

Specify the fields you want returned just as with a typical (non-mlt) query, using the fl parameter.

The mlt.fl parameter simply instructs Solr to only consider documents with similar firstName and lastName fields.

If you want those fields also returned, pass ...&fl=firstName,lastName&....

Peter Dixon-Moses
  • 3,169
  • 14
  • 18