Javascript Algolia不接受所有设置
我有以下Algolia请求:Javascript Algolia不接受所有设置,javascript,parse-platform,parse-cloud-code,algolia,Javascript,Parse Platform,Parse Cloud Code,Algolia,我有以下Algolia请求: index.setSettings({ getRankingInfo : 1, attributesToIndex:"name,colour,style,material,category", hitsPerPage: 50, ignorePlurals : fals
index.setSettings({
getRankingInfo : 1,
attributesToIndex:"name,colour,style,material,category",
hitsPerPage: 50,
ignorePlurals : false,
attributesToRetrieve : "objectID",
restrictSearchableAttributes :
"name,colour,style,material,category",
typoTolerance: "strict",
queryType: "prefixNone",
page : skipParameter
});
index.search(query, function(error, content) {
....
})
但是,有些设置似乎不适用于搜索。例如,它检索所有属性,我非常确定可搜索的属性不受限制。此外,排名信息不会被返回,正如返回的JSON所显示的那样,hits post为空,这意味着它至少不接受该设置
我正在Parse.com云代码搜索方法中运行此代码,如果这可能会对结果产生影响?有一些语法错误。 第一个
attributesToIndex
应该是一个数组:
'attributesToIndex': ["name", "colour", "style", "material", "category"]
restrictSearchableAttributes与之相同
设置设置时,您还可以从algolia获得响应,这样您就可以看到配置中的错误。例:
index.setSettings({
'customRanking': ['desc(followers)']
}, function(err, content) {
console.log(content);
});
一些有用的资源:
并确保使用最新版本的Algolia JS客户端
周日快乐!:) Hi Shipow,文档中说您可以有以下两种情况:“要用于文本搜索的属性列表(必须是attributesToIndex设置的子集)。属性之间用逗号分隔(例如“name,address”),”我还添加了函数回调,但它没有被调用,我上面打印的JSON是请求的“内容”,无论哪种方式,如果它考虑了hitsPerPage,为什么不考虑getRankingInfo呢?我最初把它作为一个数组,但它没有任何区别
index.setSettings({
'customRanking': ['desc(followers)']
}, function(err, content) {
console.log(content);
});