databasenosqlrethinkdbrethinkdb-javascriptrethinkdbdash

Rethinkdb full search by contains text


I have a lot of tries to search by same part of the string in the rethinkdb but I can not do it yet. And I receive this error:

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

Error:

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

And I'm using the rethinkdbdash library. please help me to solve this problem.


Solution

  • Use the downcase and match instead of contains is worked for me:

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