How to use suggester component in solrnet to implement autosuggest feature

437 views
Skip to first unread message

Prasad

unread,
Jan 7, 2013, 3:17:11 AM1/7/13
to sol...@googlegroups.com

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/solr/collection1/suggest?q=ha&wt=xml

Curently, My solr query looks like

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

How do i achieve the same using SolrNet API.
How should my SolrNet Query look like?

Thanks,
Prasad

Mauricio Scheffer

unread,
Jan 7, 2013, 8:50:46 AM1/7/13
to sol...@googlegroups.com

Prasad

unread,
Jan 8, 2013, 1:58:29 AM1/8/13
to sol...@googlegroups.com
Hi,

I have made the changes to pass the extraparameters


           new SolrBaseRepository.Instance<T>().Start();
            var solr = ServiceLocator.Current.GetInstance<ISolrOperations<T>>();
            var options = new QueryOptions
            {
                FilterQueries = new ISolrQuery[] { new SolrQueryByField("type", type) },               
                ExtraParams = new Dictionary<string, string> { { "qt", "suggest" } }

            };

            var results = solr.Query(keyword, options);
            return results;

However, I am not getting any results.

Enclosed is the screenshot of the results.

Thanks,
Prasad
Solrnet suggest results.png
Reply all
Reply to author
Forward
0 new messages