Hello fam! Anyone with a good explanation as to wh...
# orm-help
b
Hello fam! Anyone with a good explanation as to why
contains
fails to match if filter is the first word of text? E.g., Say
description="Chaiwa is a good guy"
, sending
filter: "guy"
matches this record but sending
filter: "chai"
fails. See implementation of the where clause for the query below:
Copy code
const where = args.filter
    ? {
        OR: [
          {
            description: { contains: args.filter },
            url: { contains: args.filter },
          },
        ],
      }
    : {};
j
Does it also match the
url
? Right now that
OR
is useless I believe. If you want to match the description OR the url, put those in two separate objects
Copy code
const where = args.filter
    ? {
        OR: [
          {
            description: { contains: args.filter },
          },
          {
            url: { contains: args.filter },
          },
        ],
      }
    : {};
👍 1
j
also check case-sensitivity isn't tripping you up
chai != Chai
b
My bad, that fixed it, @Jacob Ley. Thanks.
@Jared Fraser Noted, thanks.