首页 > 解决方案 > Rethinkdb 完全搜索包含文本

问题描述

我有很多尝试在 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库。请帮我解决这个问题。

标签: databasenosqlrethinkdbrethinkdb-javascriptrethinkdbdash

解决方案


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

进行字符串搜索时将使用match


推荐阅读