2016-05-15 205 views
0

我想要的Solr的MoreLikeThis功能類似文件的各個領域:MoreLikeThis沒有返回

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

這是工作,但響應的樣子以下:

<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> 

爲什麼不firstName,並在結果IDS 32和33返回lastName

字段類型: enter image description here enter image description here enter image description here

回答

1

其實我不知道發生了什麼,但有兩個地方我建議進行調查。

  1. 在您的查詢字符串我看到有一個參數qt=mlt。指定的請求處理程序或查詢類型參數(solrconfig.xml)可以覆蓋您的參數。所以我建議只刪除qt參數並嘗試添加mlt.match.include=true。此參數指定響應是否應包含匹配的文檔。
  2. schema.xml,特別是我建議張貼宣佈firstNamelastName的部分。
0

使用fl參數指定您想返回的字段,就像使用典型(非mlt)查詢一樣。

mlt.fl參數只是指示Solr只考慮具有類似firstNamelastName字段的文檔。

如果你想要這些字段也返回,通過...&fl=firstName,lastName&...