How to return more fields on Solr 4.5.1 Suggester?

422 views Asked by At

I am using Solr 4.5.1 to suggest movies for my system. What i need solr to return not only the move_title but also the movie_id that belongs to the movie. As an example; this is kind of what i need:

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

My search component config is like :

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

My request hadler config is like:

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

and my shema config is like below:

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

how can i manage to get other fiels using suggester in solr 4.5.1? Thanks,

0

There are 0 answers