Javascript Algolia地理搜索未看到排名信息
我正试图和Algolia建立一个有效的地理搜索系统 到目前为止,我惊讶于它是多么容易设置。接下来我要实现的是显示从找到的对象到用户选择的位置的距离 我将instantsearch.js与places.js一起使用 这是我的instantsearch设置:Javascript Algolia地理搜索未看到排名信息,javascript,algolia,Javascript,Algolia,我正试图和Algolia建立一个有效的地理搜索系统 到目前为止,我惊讶于它是多么容易设置。接下来我要实现的是显示从找到的对象到用户选择的位置的距离 我将instantsearch.js与places.js一起使用 这是我的instantsearch设置: let search = instantsearch({ appId: 'appid', apiKey: 'apikey', indexName: 'dev_index', url_sync: true,
let search = instantsearch({
appId: 'appid',
apiKey: 'apikey',
indexName: 'dev_index',
url_sync: true,
searchFunction: function(helper) {
helper.setQueryParameter('getRankingInfo', 1).search();
}
});
还有places小部件(它的名称与文档中的不同,因为我是通过NPM将其引入的)
如果我查看开发工具,在places.js小部件中选择城镇后,我会看到以下查询参数:
但是我的点击对象不包含预期的“\u rankingInfo”对象:
我做错了什么?
helper
传递给searchFunction
无法设置其他查询参数
要使其工作,您可以这样使用它:
searchFunction: function(helper) {
this.helper.setQueryParameter('getRankingInfo', true);
helper.search();
}
它会成功的
jshiddle:非常感谢!你知道距离的单位是多少吗?@Tim,单位是米-如果你知道去哪里看,很容易,再次感谢:)
searchFunction: function(helper) {
this.helper.setQueryParameter('getRankingInfo', true);
helper.search();
}