2

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,

Omer Sonmez
  • 1,168
  • 2
  • 20
  • 31
  • Hey, did you find the way to do this? – aqs Mar 17 '14 at 12:24
  • unfortunately, i did not. – Omer Sonmez Mar 17 '14 at 12:34
  • @aqs i have sent an email to solr users group. They send me a response that might help you. >That's not how its meant to work; the suggester is giving you potentially matching terms by looking at the set of terms for the given field across the index. Possibly you want to look at the MoreLikeThis component or handler? It will return matching documents, from which you have access to the fields you want. – Omer Sonmez Mar 17 '14 at 14:16
  • Thanks @Omer. Thats what I thought. Suggester doesn't seem to support our use case. I am looking at other options now – aqs Mar 18 '14 at 06:31

0 Answers0