---
title: Search Term
description: Search atoms and terms by text
url: https://docs.intuition.systems/docs/v1/graphql-api/queries/search/search-term
markdown_url: https://docs.intuition.systems/docs/v1/graphql-api/queries/search/search-term.md
version: V1
llms_index: https://docs.intuition.systems/docs/v1/llms.txt
---

Search for atoms by their label or data content.

## Search Term - Query Structure

```graphql
query SearchTerm(
  $query: String!
  $limit: Int
  $offset: Int
) {
  search_term(
    args: { query: $query }
    limit: $limit
    offset: $offset
  ) {
    id
    type
    created_at
    atom {
      label
      image
      creator {
        id
        label
        image
      }
    }
  }
}
```

## Variables

| Variable | Type | Required | Description |
|----------|------|----------|-------------|
| `query` | `String` | Yes | Search query text |
| `limit` | `Int` | No | Maximum results (default: 20) |
| `offset` | `Int` | No | Pagination offset |

```json
{
  "query": "ethereum",
  "limit": 10,
  "offset": 0
}
```

## Response Fields

The function returns `terms` rows. Metadata fields like `label`, `image`, and `creator` are accessed via the `atom` relationship:

| Field | Type | Description |
|-------|------|-------------|
| `id` | `String` | Unique term identifier |
| `type` | `term_type` | Term type |
| `created_at` | `timestamptz` | Creation timestamp |
| `atom` | `atoms` | Related atom with metadata (label, image, creator) |
| `atom.label` | `String` | Human-readable label |
| `atom.image` | `String` | Image URL (IPFS) |
| `atom.creator` | `accounts` | Creator account (id, label, image) |

## Expected Response

```json
{
  "data": {
    "search_term": [
      {
        "id": "0x906527aae4af914b1ac01ff9adfdda5dafde3b5e21f84045e0660b0a15c07769",
        "type": "Thing",
        "created_at": "2024-01-01T00:00:00Z",
        "atom": {
          "label": "Ethereum",
          "image": "ipfs://QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy",
          "creator": {
            "id": "0x88D0aF73508452c1a453356b3Fac26525aEc23A2",
            "label": "vitalik.eth",
            "image": "ipfs://Qm..."
          }
        }
      }
    ]
  }
}
```

## Interactive Example

    id: 'basic-search',
    title: 'Basic Search',
    query: `query SearchTerm($query: String!, $limit: Int!) {
  search_term(args: { query: $query }, limit: $limit) {
    id
    type
    atom {
      label
      image

}`,
    variables: {
      query: 'ethereum',
      limit: 10

  },

    id: 'search-with-creator',
    title: 'Search with Creator Info',
    query: `query SearchTerm($query: String!, $limit: Int!) {
  search_term(args: { query: $query }, limit: $limit) {
    id
    type
    created_at
    atom {
      label
      image
      creator {
        id
        label
        image

}`,
    variables: {
      query: 'bitcoin',
      limit: 5

];

## Use Cases

### Search Autocomplete

Implement search-as-you-type:

```typescript
import { debounce } from 'lodash'

async function searchAtoms(searchQuery: string, limit: number = 10) {
  if (searchQuery.length < 2) return []

  const gqlQuery = `
    query SearchTerm($query: String!, $limit: Int!) {
      search_term(args: { query: $query }, limit: $limit) {
        id
        type
        atom {
          label
          image
        }
      }
    }
  `

  const data = await client.request(gqlQuery, { query: searchQuery, limit })
  return data.search_term
}

// Debounced version for autocomplete
const debouncedSearch = debounce(searchAtoms, 300)
```

### Filter by Type

Search and filter by atom type:

```typescript
async function searchByType(
  searchQuery: string,
  type: 'Thing' | 'Person' | 'Organization'
) {
  const gqlQuery = `
    query SearchByType($query: String!, $type: String!) {
      search_term(
        args: { query: $query }
        where: { type: { _eq: $type } }
        limit: 20
      ) {
        id
        type
        atom {
          label
          image
        }
      }
    }
  `

  return client.request(gqlQuery, { query: searchQuery, type })
}
```

## Search Tips

1. **Minimum length**: Search works best with 2+ characters
2. **Case insensitive**: "ethereum" and "Ethereum" return same results
3. **Partial matching**: "eth" matches "Ethereum"
4. **Combine with filters**: Add `where` clause for type/creator filtering

## Best Practices

1. **Debounce input** - Wait 300ms after typing before searching
2. **Show loading state** - Indicate when search is in progress
3. **Handle empty results** - Show helpful message when no matches
4. **Limit results** - Start with 5-10 results, load more on demand

## Related

- [Search from Following](https://docs.intuition.systems/docs/v1/graphql-api/queries/search/search-from-following) - Social search
- [Search Positions](https://docs.intuition.systems/docs/v1/graphql-api/queries/search/search-positions) - Position search
- [List Atoms](https://docs.intuition.systems/docs/v1/graphql-api/queries/atoms/list-filter) - Filter-based atom queries
