hello i am trying parse solr suggester query output in search box but not getting exact result. plz help………..
$(document).ready(function() {
$( "#searchterm" ).autocomplete({
source: function( request, response ) {
var text = $("#searchterm").val();
$.ajax({
url: 'http://localhost:8983/solr/collection1/suggest?wt=json&indent=true&spellcheck=true&spellcheck.q='+request.term+'&spellcheck.onlyMorePopular=true&spellcheck.count=50&start=0&rows=10',
dataType: "jsonp",
jsonp: 'json.wrf',
type:'GET',
contentType: "application/json; charset=utf-8",
crossDomain: true,
success: function(data) {
response( $.map(data.spellcheck.suggestions, function(item,i) {
return {
label: item.suggestion,
value: item.suggestion
}
}));
}
});
After seeing the console.log of data your iterated elements value is
You have to work on level deeper on suggestions.suggestion