# garden.lexicon.suggest

> Published by [lexicon.garden](https://lexicon.garden/identity/did:plc:akhgi4ekkeaupiqsis6g2gqg)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:akhgi4ekkeaupiqsis6g2gqg/garden.lexicon.suggest)
- [Documentation](https://lexicon.garden/lexicon/did:plc:akhgi4ekkeaupiqsis6g2gqg/garden.lexicon.suggest/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:akhgi4ekkeaupiqsis6g2gqg/garden.lexicon.suggest/examples)

## Definitions

### `garden.lexicon.suggest`

**Type**: `query`

Typeahead suggestions for indexed lexicons. Unlike garden.lexicon.browse, the query is matched against every segment-aligned suffix of an NSID, so 'feed.post' matches 'app.bsky.feed.post'. Results are sorted by NSID ascending and are not paginated.

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `q` | `string` | Yes | Search prefix, matched against an NSID or any of its segment-aligned suffixes. |
| `limit` | `integer` | No | Maximum number of suggestions to return. |
| `lexiconType` | `array` | No | Filter suggestions to these definition types. Repeat the parameter for multiple types. Omit to include all types. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `suggestions` | `array` | Yes |  |

### `garden.lexicon.suggest#lexiconSuggestion`

**Type**: `object`

An indexed lexicon whose NSID matched the query.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `did` | `string` (did) | Yes | DID of the authority that published the lexicon. |
| `uri` | `string` (at-uri) | Yes | AT-URI of the com.atproto.lexicon.schema record backing this suggestion. |
| `nsid` | `string` (nsid) | Yes | The full NSID of the lexicon. |
| `lexiconType` | `string` | No | Definition type of the lexicon's main def. Absent when the indexed type is unknown. |

## Raw Schema

```json
{
  "id": "garden.lexicon.suggest",
  "defs": {
    "main": {
      "type": "query",
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "suggestions"
          ],
          "properties": {
            "suggestions": {
              "type": "array",
              "items": {
                "ref": "#lexiconSuggestion",
                "type": "ref"
              }
            }
          }
        },
        "encoding": "application/json"
      },
      "parameters": {
        "type": "params",
        "required": [
          "q"
        ],
        "properties": {
          "q": {
            "type": "string",
            "maxLength": 253,
            "minLength": 2,
            "description": "Search prefix, matched against an NSID or any of its segment-aligned suffixes."
          },
          "limit": {
            "type": "integer",
            "default": 10,
            "maximum": 20,
            "minimum": 1,
            "description": "Maximum number of suggestions to return."
          },
          "lexiconType": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 32,
              "knownValues": [
                "record",
                "query",
                "procedure",
                "subscription",
                "permission-set"
              ]
            },
            "maxLength": 5,
            "description": "Filter suggestions to these definition types. Repeat the parameter for multiple types. Omit to include all types."
          }
        }
      },
      "description": "Typeahead suggestions for indexed lexicons. Unlike garden.lexicon.browse, the query is matched against every segment-aligned suffix of an NSID, so 'feed.post' matches 'app.bsky.feed.post'. Results are sorted by NSID ascending and are not paginated."
    },
    "lexiconSuggestion": {
      "type": "object",
      "required": [
        "nsid",
        "did",
        "uri"
      ],
      "properties": {
        "did": {
          "type": "string",
          "format": "did",
          "description": "DID of the authority that published the lexicon."
        },
        "uri": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the com.atproto.lexicon.schema record backing this suggestion."
        },
        "nsid": {
          "type": "string",
          "format": "nsid",
          "description": "The full NSID of the lexicon."
        },
        "lexiconType": {
          "type": "string",
          "maxLength": 32,
          "description": "Definition type of the lexicon's main def. Absent when the indexed type is unknown.",
          "knownValues": [
            "record",
            "query",
            "procedure",
            "subscription",
            "permission-set"
          ]
        }
      },
      "description": "An indexed lexicon whose NSID matched the query."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
