Advanced Search

Advanced Search with searchCustom

The searchCustom filter provides advanced search capabilities with additional searchable fields and the ability to expand results to include related records.

Input Structure

The searchCustom filter accepts an INPUT_OBJECT with the following fields:

  • terms (String) - The search query to apply. All terms must match (case-insensitive AND logic). Multiple words can be quoted to search as a phrase.
  • include ([String]) - Additional field names to search beyond the default searchable fields. These fields are added to the search scope, not used to replace it.
  • extend ([String]) - Field names containing references to related records. When a record matches, related records referenced by these fields are also included in the results.

How it works

  1. Search Phase: The terms are searched across default searchable fields PLUS any fields specified in include
  2. Extension Phase: For each matching record, if extend is provided, follow the field references to include related records in the results

Key behaviors

  • All search terms must match (AND logic, case-insensitive)
  • include adds to default fields; it does not restrict search to only those fields
  • extend does not search additional fields; it expands the result set by following relationships
  • Both parameters are optional and can be used independently or together

Usage Patterns

Basic search

Searches default searchable fields:

query {
  collectionViewConnection(
    first: 10
    searchCustom: {
      terms: "red widget"
    }
  ) {
    edges {
      node {
        collectionId
      }
    }
  }
}

Include additional fields in search

query {
  collectionViewConnection(
    first: 10
    searchCustom: {
      terms: "acme"
      include: ["customField1", "customField2"]
    }
  ) {
    edges {
      node {
        collectionId
      }
    }
  }
}

Expand results to include related records

query {
  collectionViewConnection(
    first: 10
    searchCustom: {
      terms: "urgent"
      extend: ["relatedRecordUrl"]
    }
  ) {
    edges {
      node {
        collectionId
      }
    }
  }
}

Combine include and extend

query {
  collectionViewConnection(
    first: 10
    searchCustom: {
      terms: "acme corp"
      include: ["customField1"]
      extend: ["relatedRecordUrl"]
    }
  ) {
    edges {
      node {
        collectionId
      }
    }
  }
}