How to get the suggester component working in SolrNet?

前端 未结 5 1161
遥遥无期
遥遥无期 2020-12-30 16:06

I have configured my solrconfig.xml and schema.xml to query for the suggestions.

I am able to get the suggestions from the url

http://localhost:8080/         


        
5条回答
  •  太阳男子
    2020-12-30 17:03

    In order to execute your query against the /suggest request handler that you have setup, you will need to set the qt Solr parameter using the ExtraParameters in your SolrNet QueryOptions like below:

     new SolrBaseRepository.Instance().Start();
     var solr = ServiceLocator.Current.GetInstance>();
     var options = new QueryOptions
     {
         FilterQueries = new ISolrQuery[] { new SolrQueryByField("type", type) },
         ExtraParams = new Dictionary{{"qt", "suggest"}},
     };
     var results = solr.Query(keyword, options);
     return results;
    

    Otherwise your query is still executing against the standard /select request handler (or whatever you have defined as the default in your solrconfig.xml).

提交回复
热议问题