GraphQL search broken in Ticket Replies & Comments

Finally playing around with GraphQL. It’s amazing.

Search works in Tickets, but not in Ticket Replies.

Here’s an example in my system:

{
  ticket_replies(id:40) {
    entities {
      id
      ticket_id
      body
    }
  }
}

RESULTS:

{
  "data": {
    "ticket_replies": {
      "entities": [
        {
          "id": "40",
          "ticket_id": "30",
          "body": "Hello,<br />\nI will be home today at 5:30 pm, so 5:45 pm would be a good time to run<br />\nthis remote session. What information do you need from me to perform this?<br />\nThanks."
        }
      ]
    }
  }
}

So, I should be able to search ticket_replies for "Hello" or "today" right? Neither work.

{
  ticket_replies(general_search:"today") {
    entities {
      id
      ticket_id
      body
    }
  }
}

RESULTS:

{
  "data": {
    "ticket_replies": {
      "entities": []
    }
  }
}

Same issue with Ticket Comments.

Thanks, I’m glad you like it!

Yeah, that is a bit of a problem with the text search because large text fields aren’t indexed for search like that. If you use the search object instead though, it should work. The general_search only works across string fields. Here’s an example:

Query:

query foo($search: Search) {
  ticket_replies(search: [$search]) {
    entities {
      body
    }
  }
}

Variables:

{
  "search": {
    "string_fields": [
      {
        "attribute": "body",
        "search_value": "test",
        "match": true,
        "partial_matching": true
      }
    ]
  }
}
1 Like

Yeah, check my post - edited it up with an example.

It works!!

1 Like

You’re welcome, let me know if you get stuck again!