You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "anurag.jain" <an...@gmail.com> on 2013/01/10 18:23:32 UTC

Auto completion

Hello,
I am new solr user. i updated schema.xml and solrconfig.xml now in this link 
"http://localhost:8983/solr/browse" auto completion is not working :( .
please tell me how should i modify that file so i can do my work(auto
completion). please reply urgent.

thanks   



--
View this message in context: http://lucene.472066.n3.nabble.com/Auto-completion-tp4032267.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Auto completion

Posted by "anurag.jain" <an...@gmail.com>.
and yes i am using solr 4.0 version 



--
View this message in context: http://lucene.472066.n3.nabble.com/Auto-completion-tp4032267p4032451.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Auto completion

Posted by Erik Hatcher <er...@gmail.com>.
In the default /browse suggest, it's wired together with the 'name' field in a couple of places:

head.vm:
  'terms.fl': 'name',

suggest.vm:
  #foreach($t in $response.response.terms.name)

I'll aim to make this more dynamic in the future, but for now if you're adapting from what's there now to use a different field you'll need to hack those two spots.  That second spot is simply a path navigation reference in the terms component response that puts the field name as one level in the response structure.

So in your example, if you wanted to suggest from 'text', substitute 'text' for 'name' in the spots just mentioned.

	Erik



On Jan 11, 2013, at 01:21 , anurag.jain wrote:

> in solrconfig.xml 
> 
> 
>       <str name="defType">edismax</str>
>       <str name="qf">
>          text^0.5 last_name^1.0 first_name^1.2 course_name^7.0 id^10.0
> branch_name^1.1 hq_passout_year^1.4
>          course_type^10.0 institute_name^5.0 qualification_type^5.0
> mail^2.0 state_name^1.0
>       </str>
>       <str name="df">text</str>
>       <str name="mm">100%</str>
>       <str name="q.alt">*:*</str>
>       <str name="rows">10</str>
>       <str name="fl">*,score</str>
> 
>       <str name="mlt.qf">
>         text^0.5 last_name^1.0 first_name^1.2 course_name^7.0 id^10.0
> branch_name^1.1 hq_passout_year^1.4
>          course_type^10.0 institute_name^5.0 qualification_type^5.0
> mail^2.0 state_name^1.0
>       </str>
>       <str
> name="mlt.fl">text,last_name,first_name,course_name,id,branch_name,hq_passout_year,course_type,institute_name,qualification_type,mail,state_name</str>
>       <int name="mlt.count">3</int>
> 
> 
>       <str name="facet">on</str>
>       <str name="facet.field">is_top_institute</str>
>       <str name="facet.field">course_name</str>
> 
>       <str name="facet.range">cgpa</str>
>       <int name="f.cgpa.facet.range.start">0</int>
>       <int name="f.cgpa.facet.range.end">10</int>
>       <int name="f.cgpa.facet.range.gap">2</int>
> 
> 
> 
> 
> and in schema.xml
> 
> 
> 
>   <field name="id" type="text_general" indexed="true" stored="true"
> required="true" multiValued="false" /> 
>   <field name="first_name" type="text_general" indexed="false"
> stored="true"/>
>   <field name="last_name" type="text_general" indexed="false"
> stored="true"/>
>   <field name="institute_name" type="text_general" indexed="true"
> stored="true"/>
>    ...
>    ...
>    ...
> 
> 
>    <copyField source="first_name" dest="text"/>
>    <copyField source="last_name" dest="text"/>
>     <copyField source="institute_name" dest="text"/>
>     ...
>     ...
>     ...
> 
> 
> so please now tell me what will be JavaScript (terms.fl parameter) ? and
> conf/velocity/head.vm, and also the 'name' reference in suggest.vm. 
> 
> 
> please reply .. and thanks for previous reply ..  :-)
> 
> 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Auto-completion-tp4032267p4032450.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Auto completion

Posted by "anurag.jain" <an...@gmail.com>.
in solrconfig.xml 

 
       <str name="defType">edismax</str>
       <str name="qf">
          text^0.5 last_name^1.0 first_name^1.2 course_name^7.0 id^10.0
branch_name^1.1 hq_passout_year^1.4
          course_type^10.0 institute_name^5.0 qualification_type^5.0
mail^2.0 state_name^1.0
       </str>
       <str name="df">text</str>
       <str name="mm">100%</str>
       <str name="q.alt">*:*</str>
       <str name="rows">10</str>
       <str name="fl">*,score</str>

       <str name="mlt.qf">
         text^0.5 last_name^1.0 first_name^1.2 course_name^7.0 id^10.0
branch_name^1.1 hq_passout_year^1.4
          course_type^10.0 institute_name^5.0 qualification_type^5.0
mail^2.0 state_name^1.0
       </str>
       <str
name="mlt.fl">text,last_name,first_name,course_name,id,branch_name,hq_passout_year,course_type,institute_name,qualification_type,mail,state_name</str>
       <int name="mlt.count">3</int>

       
       <str name="facet">on</str>
       <str name="facet.field">is_top_institute</str>
       <str name="facet.field">course_name</str>
      
       <str name="facet.range">cgpa</str>
       <int name="f.cgpa.facet.range.start">0</int>
       <int name="f.cgpa.facet.range.end">10</int>
       <int name="f.cgpa.facet.range.gap">2</int>




and in schema.xml



   <field name="id" type="text_general" indexed="true" stored="true"
required="true" multiValued="false" /> 
   <field name="first_name" type="text_general" indexed="false"
stored="true"/>
   <field name="last_name" type="text_general" indexed="false"
stored="true"/>
   <field name="institute_name" type="text_general" indexed="true"
stored="true"/>
    ...
    ...
    ...


    <copyField source="first_name" dest="text"/>
    <copyField source="last_name" dest="text"/>
     <copyField source="institute_name" dest="text"/>
     ...
     ...
     ...


so please now tell me what will be JavaScript (terms.fl parameter) ? and
conf/velocity/head.vm, and also the 'name' reference in suggest.vm. 


please reply .. and thanks for previous reply ..  :-)



--
View this message in context: http://lucene.472066.n3.nabble.com/Auto-completion-tp4032267p4032450.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Auto completion

Posted by Erik Hatcher <er...@gmail.com>.
What modifications did you make?   If you changed the field name (it's literally 'name') in the example, you'll need to change the JavaScript (terms.fl parameter) in the autocomplete stuff in conf/velocity/head.vm, and also the 'name' reference in suggest.vm.  That should be all you need to change for that.  

Check your Solr log/console output and see what the actual requests being made to Solr are formed as, and give those a try directly through your browser to see what is returned to troubleshoot it further.

	Erik

On Jan 10, 2013, at 12:23 , anurag.jain wrote:

> Hello,
> I am new solr user. i updated schema.xml and solrconfig.xml now in this link 
> "http://localhost:8983/solr/browse" auto completion is not working :( .
> please tell me how should i modify that file so i can do my work(auto
> completion). please reply urgent.
> 
> thanks   
> 
> 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Auto-completion-tp4032267.html
> Sent from the Solr - User mailing list archive at Nabble.com.