searching functionality with graphql

default discord avatar
bhavikak
last month
9

hello is it possible to implement searching functionality with graphql.

  • discord user avatar
    denolfe
    Payload Team
    4 weeks ago

    Yes, the "plural" version of the collections can accept a where clause like this:

    image.png
  • default discord avatar
    bhavikak
    4 weeks ago

    but it's like an filter. i get all pages title that include abc keyword in title.

  • discord user avatar
    denolfe
    Payload Team
    4 weeks ago

    That is not the behavior that I'm seeing



    Here is if I modify the above query

    CleanShot_2023-04-24_at_09.54.21.png
  • default discord avatar
    bhavikak
    4 weeks ago

    okay @denolfe it means i have to choose another way right?

  • discord user avatar
    denolfe
    Payload Team
    4 weeks ago

    No, you were claiming that you were getting "all pages title that include abc keyword", and I showed you that

    equals

    searches the field in its entirety



    The

    like

    keyword instead of

    equals

    can be used for partial searches.

  • default discord avatar
    bhavikak
    4 weeks ago

    it's working 🤘



    thanks a lot @denolfe for the help.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.