有没有办法让 Algolia 从逗号分隔的 JSON 字段中创建单独的细化方面
Is there a way for Algolia to create separate refinement facets from a comma delineated JSON field
我是 Algolia 搜索的新手。我的设置是 React 和 Firebase,我的 Firebase 用户 table 在 Algolia 中被索引。我正在使用 refinementList 小部件和标签来允许用户更好地过滤,但我想知道是否有一种方法可以将字段中的单词作为单独的优化来分隔。例如:
colors: "red, blue, green, white"
有没有一种方法可以构建我的数据,使这些颜色作为 refinementList 或标签云中的单独项目?我尝试使用方括号,这是我在另一个堆栈溢出 post 中看到的一种技术,但没有用。谢谢!
Algolia 使用数组,所以解决方案是将 colors: "red, blue, green, white"
更改为 colors: ["red, "blue", "green", "white"]
,您可以使用
var colors = "red, blue, green, white,value with space"
var splitColors = colors.split(/[,]+/).map(str=>str.trim())
然后您可以将 splitColors
作为 colors
属性推送到 Algolia
另见
我是 Algolia 搜索的新手。我的设置是 React 和 Firebase,我的 Firebase 用户 table 在 Algolia 中被索引。我正在使用 refinementList 小部件和标签来允许用户更好地过滤,但我想知道是否有一种方法可以将字段中的单词作为单独的优化来分隔。例如:
colors: "red, blue, green, white"
有没有一种方法可以构建我的数据,使这些颜色作为 refinementList 或标签云中的单独项目?我尝试使用方括号,这是我在另一个堆栈溢出 post 中看到的一种技术,但没有用。谢谢!
Algolia 使用数组,所以解决方案是将 colors: "red, blue, green, white"
更改为 colors: ["red, "blue", "green", "white"]
,您可以使用
var colors = "red, blue, green, white,value with space"
var splitColors = colors.split(/[,]+/).map(str=>str.trim())
然后您可以将 splitColors
作为 colors
属性推送到 Algolia
另见