Database 按包含文本重新定义数据库完整搜索
我在数据库中多次尝试按字符串的同一部分进行搜索,但我还不能这样做。 我收到这个错误:Database 按包含文本重新定义数据库完整搜索,database,nosql,rethinkdb,rethinkdb-javascript,rethinkdbdash,Database,Nosql,Rethinkdb,Rethinkdb Javascript,Rethinkdbdash,我在数据库中多次尝试按字符串的同一部分进行搜索,但我还不能这样做。 我收到这个错误: db.table("jobs") .filter(db.row("title").contains(title)) .filter({ locationCode: location }) .run() .then(result => { res.json({ result,
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"
})
我正在使用数据库。
请帮助我解决此问题。使用downcase和match,而不是contains对我有效:
.filter(db.row("title").downcase().match(title.toLowerCase()))
contains用于检查序列中是否存在元素 进行字符串搜索时将使用匹配