How to get Suggestions in Solr 5.3.0

前端 未结 1 458
清歌不尽
清歌不尽 2021-01-15 07:35

I am trying to implement auto complete feature using Solr 5.3.0

solrconfig.xml looks like this



        
相关标签:
1条回答
  • 2021-01-15 08:09

    The field on which you want to configure the suggester should be store=true. It need not to be indexed. The suggester configuration will build a dictionary according to the provide configuration in the suggestComponet. The name field have stored as true where as suggest_ngram is not. You need to update the schema configuration like this:

    <field name="suggest_ngram" type="text_suggest_ngram" indexed="false" stored="true"/>
    

    Also you need to provide the parameter suggest.dictionary, the dictionary you are using for suggestions. For you it is names as default.

    http://localhost:8983/solr/products/suggest?suggest=true&
           suggest.build=true&
           wt=json&
           suggest.dictionary=default&
           suggest.q=Jind
    

    OR you can provide the dictionary configuration in requestHandler of /suggest:

    <str name="suggest.dictionary">default</str>
    
    0 讨论(0)
提交回复
热议问题