How to search the exact data using ArcQL term query

In the previous post, we have seen how to sort the data.

Now we will check how to search the exact data using the arcql term query.

  • Term query returns results matching the provided value
  • AND/ OR Boolean logic is possible to get the specific record.
  • Frame a query like this.
a = 'some string' OR 123 AND 'abc'

We will work with the same arcqlObject data type used earlier. Just added an int field here.

type arcqlObject {
    str: String
    int: Int
}

Sample Query

Let’s find the hypi.id of an object with str value as hypi or int value as 3

{
  find(type: arcqlObject, arcql: "str = 'hypi' OR int = 3") {
    edges {
      node {
        ... on arcqlObject {
          str
          int
          hypi {
            id
          }
        }
      }
      cursor
    }
  }
}
#result
{
  "data": {
    "find": {
      "edges": [
        {
          "node": {
            "str": "hypi",
            "int": 1,
            "hypi": {
              "id": "01FJ9PZGEH9KYWWFEEM2V7EZ81"
            }
          },
          "cursor": "01FJ9PZGEH9KYWWFEEM2V7EZ81"
        },
        {
          "node": {
            "str": "low code",
            "int": 3,
            "hypi": {
              "id": "01FJ9PZGEKEHFBCGG9CYT47PYX"
            }
          },
          "cursor": "01FJ9PZGEKEHFBCGG9CYT47PYX"
        }
      ]
    }
  }
}

Query Variables

query GetMatchingRecord($type: HypiMutationType!, $arcql: String!) {
  find(type: $type, arcql: $arcql) {
    edges {
      cursor
      node {
        ... on arcqlObject {
          hypi {
            id
          }
          str
          int
        }
      }
    }
  }
}
#query variables
{
  "type": "arcqlObject",
  "arcql": "str = 'hypi' OR int = 3"
 }

Check the POSTMAN collection for the term query requests in different programming languages! Click </> and choose the programming language of your choice.
Don’t forget to insert your own Authorization key and Hypi Domain under Headers to test the results!

Run in Postman