I'm new to Twitter Typeahead (typeahead.js 0.11.1) and I'm trying to configure it with Thymeleaf + Spring MVC using the remote option.
Here is my controller class:
@Controller
public class AutocompleteController {
@Autowired
private IRefDataService refDataService;
@RequestMapping(value = "/get_user_firstname_suggestions.json", method = RequestMethod.GET)
public @ResponseBody List<String> getUserFirstNameSuggestions(@RequestParam("searchTerm") String searchTerm) {
return refDataService.getUserFirstNameSuggestions(searchTerm);
}
}
Here is my javascript code:
// constructs the suggestion engine
var firstNames = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote:{
url: "/hub/get_user_firstname_suggestions.json?searchTerm=%QUERY"
}
});
//Initialize the Bloodhound suggestion engine
firstNames.initialize();
$([[${'#' + heading.fieldName}]]).typeahead({
hint: true,
highlight: true,
minLength: 2
},
{
name: 'firstNames',
display: 'value',
source: firstNames.ttAdapter()
});
When I try to run my application, I am getting the following message:
INFO: Character decoding failed. Parameter [searchTerm] with value [%QUERY] has been ignored. Note that the name and value quoted here may be corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.
Note: further occurrences of Parameter errors will be logged at DEBUG level.
Any ideas how I can resolve this?