我正在使用Solr 4.5.1为我的系统推荐电影。我需要solr不仅返回move_title,还返回属于电影的movie_id。举个例子;这就是我需要的东西:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
</lst>
<lst name="spellcheck">
<lst name="suggestions">
<lst name="har">
<int name="numFound">6</int>
<int name="startOffset">0</int>
<int name="endOffset">3</int>
<arr name="suggestion">
<doc>
<str name="name_autocomplete">hard eight (1996)</str>
<str name="movie_id">144</str>
</doc>
<doc>
<str name="name_autocomplete">hard rain (1998)</str>
<str name="movie_id">14</str>
</doc>
<doc>
<str name="name_autocomplete">harlem (1993)</str>
<str name="movie_id">1044</str>
</doc>
</arr>
</lst>
</lst>
</lst>
</response>
我的搜索组件配置如下:
<searchComponent name="suggest" class="solr.SpellCheckComponent">
<lst name="spellchecker">
<str name="name">suggest</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
<str name="field">name_autocomplete</str>
<str name="spellcheck.onlyMorePopular">true</str>
</lst>
</searchComponent>
我的请求hadler配置如下:
<requestHandler name="/suggest" class="org.apache.solr.handler.component.SearchHandler">
<lst name="defaults">
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">suggest</str>
<str name="spellcheck.count">10</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
我的shema配置如下:
<field name="movie_id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="movie_title" type="text" indexed="true" stored="true" multiValued="false" />
<!--<field name="name_auto" type="text_auto" indexed="true" stored="true" multiValued="false" />-->
<field name="name_autocomplete" type="text_auto" indexed="true" stored="true" multiValued="false" />
<copyField source="movie_title" dest="name_autocomplete" />
我如何设法在solr 4.5.1中使用建议器获取其他fiels? 谢谢,