我想使用Bloodhound的多个数据集功能从本地数据库获取结果,另一个从 google places api 获取结果。我可以从我的本地数据库中获取结果,如下所示,
// instantiate the bloodhound suggestion engine
var searchData = new Bloodhound({
datumTokenizer: function (d) {
return Bloodhound.tokenizers.whitespace(d.value);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: 'http:://localhost/address/fetch?q=%Query' //Local URL
}
});
// initialize the bloodhound suggestion engine
searchData.initialize();
// instantiate the typeahead UI
$('.typeahead').typeahead({
hint:false,
highlight: true,
minLength: 3
}, {
name:'search-data',
displayKey: 'title',
source: searchData.ttAdapter(),
templates: {
suggestion: Handlebars.compile('<p><strong>{{title}}</strong></p>')
}
});
我想使用 Bloodhound 多数据集功能将本地数据库结果与 google Places api 结果结合起来。
如何使用 bootstrap Bloodhound 获取 google places api 结果?