Algolia Geo Search 看不到排名信息

Algolia Geo Search not seeing ranking info

我正在尝试使用 Algolia 设置工作地理搜索。

到目前为止,我对它的设置如此简单感到震惊。接下来我要实现的是显示从找到的对象到用户选择的位置的距离。

我正在使用 instantsearch.js 和 places.js。

这是我的即时搜索设置:

let search = instantsearch({
    appId: 'appid',
    apiKey: 'apikey',
    indexName: 'dev_index',
    url_sync: true,
    searchFunction: function(helper) {
        helper.setQueryParameter('getRankingInfo', 1).search();
    }
});

还有 places 小部件(它的名称与文档中的名称不同,因为我是通过 NPM 引入的)

search.addWidget(
    placesWidget({
        container: '#places-box',
        type: 'city',
        aroundLatLngViaIP: false,
        countries: 'de'
    })
);

如果我查看开发工具,我会在 places.js 小部件中选择一个城镇后看到以下查询参数:

但是我的点击对象不包含预期的“_rankingInfo”对象:

我做错了什么?

helper 传递给 searchFunction 无法设置额外的查询参数。

要使其正常工作,您可以这样使用它:

searchFunction: function(helper) {
    this.helper.setQueryParameter('getRankingInfo', true);

    helper.search();
}

它会成功的。

jsFiddle: https://jsfiddle.net/ur6qetp1/