I am trying to implement Solr suggester. I am able to fetch the response from Solr, but unable to extract only the suggested terms out of the response.
Response looks like:
{
"responseHeader":{
"status":0,
"QTime":1},
"suggest":{"mySuggester":{
"agi":{
"numFound":2,
"suggestions":[{
"term":"IGADC_T200_<b>Agi</b>le-Planning-and-Estimation",
"weight":0,
"payload":""},
{
"term":"IGADC_T200_<b>Agi</b>leOverview",
"weight":0,
"payload":""}]}}}}
How can I fetch only the terms out of this response.
SolrQuery sq = new SolrQuery();
sq.setRequestHandler("/suggest");
sq.set("suggest.dictionary", "mySuggester");
sq.set("suggest.q",keyword);
sq.set("suggest",true);
sq.set("suggest.build", "true");
sq.set("suggest.count",10);
I tried using :
SpellCheckResponse spellCheckResponse = response.getSpellCheckResponse();
but it returns null, even though my response contains the suggestions.
Thanks in advance.