そのため、Algolia.com を使用して、ユーザーをすばやく検索できるようにインデックスを作成しています。
インデックス内のオブジェクトの例:
{
id: 1,
username: "john.doe",
name: "John Doe",
attributes: {
gender: "male",
hair_color: "blonde",
eye_color: "blue",
height: 165
}
}
属性オブジェクトの特定の属性 (オブジェクト キー) で結果をフィルター処理したいと思います。
を使用するとうまくいくのではないかと思いfacetFilters
ましたが、うまくいきません。
私はこのコードの多くのバリエーションを試しました:
user_index.search('', {
facets: '*',
facetFilters: ['attributes.hair_color:blonde', 'attributes.eye_color:blue']
}, function(error, data) {
console.log(error, data);
});
-- / --
user_index.search('', {
facets: '*',
facetFilters: ['hair_color:blonde']
}, function(error, data) {
console.log(error, data);
});
ここでドキュメントを見つけてください: https://www.algolia.com/doc/javascript