【问题标题】:Rethinkdb full search by contains textRethinkdb 完全搜索包含文本
【发布时间】:2018-10-17 09:00:38
【问题描述】:

我有很多尝试在 rethinkdb 中搜索字符串的同一部分,但我还不能这样做。 我收到此错误:

db.table("jobs")
        .filter(db.row("title").contains(title))
        .filter({ locationCode: location })
        .run()
        .then(result => {
            res.json({
                result,
                meta: {
                    title,
                    location,
                    count: result.length,
                },
            });
        });

错误:

Unhandled rejection ReqlLogicError: Cannot convert STRING to SEQUENCE in:
r.table("jobs").filter(r.row("title").contains("front")).filter({
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  locationCode: "216"
})

我正在使用 rethinkdbdash 库。 请帮我解决这个问题。

【问题讨论】:

    标签: database nosql rethinkdb rethinkdb-javascript rethinkdbdash


    【解决方案1】:

    contains用于检查一个元素是否存在于一个序列中

    ma​​tch 用于字符串搜索

    【讨论】:

      【解决方案2】:

      使用小写和匹配而不是包含对我有用:

      .filter(db.row("title").downcase().match(title.toLowerCase()))
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-02-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-16
        • 1970-01-01
        • 2021-12-17
        • 2011-05-03
        相关资源
        最近更新 更多