# town.delve.feed.searchPostsV2

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

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:qzqct2rrq4u2gmy5g3mjxske/town.delve.feed.searchPostsV2)
- [Documentation](https://lexicon.garden/lexicon/did:plc:qzqct2rrq4u2gmy5g3mjxske/town.delve.feed.searchPostsV2/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:qzqct2rrq4u2gmy5g3mjxske/town.delve.feed.searchPostsV2/examples)

## Definitions

### `town.delve.feed.searchPostsV2`

**Type**: `query`

Find posts matching a search query or filters, returning search hits for matching post records.

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `allTime` | `boolean` | No | Search the full index instead of the recent-post window. |
| `authors` | `array` | No | Include posts by any of these authors. Handles are resolved to DIDs before searching. |
| `cursor` | `string` | No | Optional pagination cursor. |
| `domains` | `array` | No | Include posts that link to any of these domains. |
| `embeddedAtUris` | `array` | No | Include posts that embed any of these AT URIs. |
| `excludeAuthors` | `array` | No | Exclude posts by any of these authors. Handles are resolved to DIDs before searching. |
| `excludeDomains` | `array` | No | Exclude posts that link to any of these domains. |
| `excludeEmbeddedAtUris` | `array` | No | Exclude posts that embed any of these AT URIs. |
| `excludeHashtags` | `array` | No | Exclude posts tagged with any of these hashtags. Do not include the hash (#) prefix. |
| `excludeLanguages` | `array` | No | Exclude posts whose language matches any of these language codes. |
| `excludeMentions` | `array` | No | Exclude posts that mention any of these accounts. Handles are resolved to DIDs before searching. |
| `excludeReplies` | `boolean` | No | Exclude replies from results. Mutually exclusive with repliesOnly. |
| `excludeUrls` | `array` | No | Exclude posts that link to any of these URLs. |
| `following` | `boolean` | No | Include only posts from accounts followed by the viewer. |
| `hasMedia` | `boolean` | No | Include only posts with media. |
| `hasVideo` | `boolean` | No | Include only posts with video. |
| `hashtags` | `array` | No | Include posts tagged with any of these hashtags. Do not include the hash (#) prefix. |
| `languages` | `array` | No | Include posts whose language matches any of these language codes. |
| `limit` | `integer` | No | Maximum number of results to return. |
| `mentions` | `array` | No | Include posts that mention any of these accounts. Handles are resolved to DIDs before searching. |
| `query` | `string` | No | Search query string. A query or at least one filter is required. |
| `queryLanguage` | `string` | No | Language analyzer hint for the query text. If unset, the server auto-detects when possible. |
| `repliesOnly` | `boolean` | No | Include only replies. Mutually exclusive with excludeReplies. |
| `replyParentUri` | `string` (at-uri) | No | Include only direct replies to this parent post URI. |
| `since` | `string` | No | Include posts indexed at or after this timestamp. Can be a datetime, or just an ISO date (YYYY-MM-DD). |
| `sort` | `string` | No | Ranking order for results. 'recent' sorts by recency; 'top' uses search ranking. |
| `threadRootUri` | `string` (at-uri) | No | Include only posts in the thread rooted at this post URI. |
| `until` | `string` | No | Include posts indexed before this timestamp. Defaults to the current time. Can be a datetime, or just an ISO date (YYYY-MM-DD). |
| `urls` | `array` | No | Include posts that link to any of these URLs. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `cursor` | `string` | No | Cursor for the next page of results. |
| `detectedQueryLanguages` | `array` | No | Query languages detected for CJK, Thai, or Arabic text. Empty or omitted for other scripts. |
| `hitsTotal` | `integer` | No | Estimated total number of matching hits. May be rounded or truncated. |
| `posts` | `array` | Yes | Hydrated views of matching posts. |

#### Errors

- **BadQueryString**

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Find posts matching a search query or filters, returning search hits for matching post records.",
      "errors": [
        {
          "name": "BadQueryString"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cursor": {
              "description": "Cursor for the next page of results.",
              "type": "string"
            },
            "detectedQueryLanguages": {
              "description": "Query languages detected for CJK, Thai, or Arabic text. Empty or omitted for other scripts.",
              "items": {
                "knownValues": [
                  "ja",
                  "zh",
                  "ko",
                  "th",
                  "ar"
                ],
                "type": "string"
              },
              "type": "array"
            },
            "hitsTotal": {
              "description": "Estimated total number of matching hits. May be rounded or truncated.",
              "type": "integer"
            },
            "posts": {
              "description": "Hydrated views of matching posts.",
              "items": {
                "ref": "town.delve.feed.defs#postView",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "posts"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "allTime": {
            "description": "Search the full index instead of the recent-post window.",
            "type": "boolean"
          },
          "authors": {
            "description": "Include posts by any of these authors. Handles are resolved to DIDs before searching.",
            "items": {
              "format": "at-identifier",
              "type": "string"
            },
            "type": "array"
          },
          "cursor": {
            "description": "Optional pagination cursor.",
            "type": "string"
          },
          "domains": {
            "description": "Include posts that link to any of these domains.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "embeddedAtUris": {
            "description": "Include posts that embed any of these AT URIs.",
            "items": {
              "format": "at-uri",
              "type": "string"
            },
            "type": "array"
          },
          "excludeAuthors": {
            "description": "Exclude posts by any of these authors. Handles are resolved to DIDs before searching.",
            "items": {
              "format": "at-identifier",
              "type": "string"
            },
            "type": "array"
          },
          "excludeDomains": {
            "description": "Exclude posts that link to any of these domains.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "excludeEmbeddedAtUris": {
            "description": "Exclude posts that embed any of these AT URIs.",
            "items": {
              "format": "at-uri",
              "type": "string"
            },
            "type": "array"
          },
          "excludeHashtags": {
            "description": "Exclude posts tagged with any of these hashtags. Do not include the hash (#) prefix.",
            "items": {
              "maxGraphemes": 64,
              "maxLength": 640,
              "type": "string"
            },
            "type": "array"
          },
          "excludeLanguages": {
            "description": "Exclude posts whose language matches any of these language codes.",
            "items": {
              "format": "language",
              "type": "string"
            },
            "type": "array"
          },
          "excludeMentions": {
            "description": "Exclude posts that mention any of these accounts. Handles are resolved to DIDs before searching.",
            "items": {
              "format": "at-identifier",
              "type": "string"
            },
            "type": "array"
          },
          "excludeReplies": {
            "description": "Exclude replies from results. Mutually exclusive with repliesOnly.",
            "type": "boolean"
          },
          "excludeUrls": {
            "description": "Exclude posts that link to any of these URLs.",
            "items": {
              "format": "uri",
              "type": "string"
            },
            "type": "array"
          },
          "following": {
            "description": "Include only posts from accounts followed by the viewer.",
            "type": "boolean"
          },
          "hasMedia": {
            "description": "Include only posts with media.",
            "type": "boolean"
          },
          "hasVideo": {
            "description": "Include only posts with video.",
            "type": "boolean"
          },
          "hashtags": {
            "description": "Include posts tagged with any of these hashtags. Do not include the hash (#) prefix.",
            "items": {
              "maxGraphemes": 64,
              "maxLength": 640,
              "type": "string"
            },
            "type": "array"
          },
          "languages": {
            "description": "Include posts whose language matches any of these language codes.",
            "items": {
              "format": "language",
              "type": "string"
            },
            "type": "array"
          },
          "limit": {
            "default": 25,
            "description": "Maximum number of results to return.",
            "maximum": 100,
            "minimum": 1,
            "type": "integer"
          },
          "mentions": {
            "description": "Include posts that mention any of these accounts. Handles are resolved to DIDs before searching.",
            "items": {
              "format": "at-identifier",
              "type": "string"
            },
            "type": "array"
          },
          "query": {
            "description": "Search query string. A query or at least one filter is required.",
            "type": "string"
          },
          "queryLanguage": {
            "description": "Language analyzer hint for the query text. If unset, the server auto-detects when possible.",
            "knownValues": [
              "ja",
              "zh",
              "ko",
              "th",
              "ar"
            ],
            "type": "string"
          },
          "repliesOnly": {
            "description": "Include only replies. Mutually exclusive with excludeReplies.",
            "type": "boolean"
          },
          "replyParentUri": {
            "description": "Include only direct replies to this parent post URI.",
            "format": "at-uri",
            "type": "string"
          },
          "since": {
            "description": "Include posts indexed at or after this timestamp. Can be a datetime, or just an ISO date (YYYY-MM-DD).",
            "type": "string"
          },
          "sort": {
            "description": "Ranking order for results. 'recent' sorts by recency; 'top' uses search ranking.",
            "knownValues": [
              "recent",
              "top"
            ],
            "type": "string"
          },
          "threadRootUri": {
            "description": "Include only posts in the thread rooted at this post URI.",
            "format": "at-uri",
            "type": "string"
          },
          "until": {
            "description": "Include posts indexed before this timestamp. Defaults to the current time. Can be a datetime, or just an ISO date (YYYY-MM-DD).",
            "type": "string"
          },
          "urls": {
            "description": "Include posts that link to any of these URLs.",
            "items": {
              "format": "uri",
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [],
        "type": "params"
      },
      "type": "query"
    }
  },
  "id": "town.delve.feed.searchPostsV2",
  "lexicon": 1
}
```
