> ## Documentation Index
> Fetch the complete documentation index at: https://social-b97141fb-auto-generate-llmstxt.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Communities

> Search communities semantically with category, tag, membership, and discoverable private community filters.

Use community semantic search when a discovery experience should match a user's intent instead of only exact community names. The client SDK sends a query and optional filters, then observes or receives a paginated set of `AmityCommunity` results.

## Parameters

| Parameter                        | TypeScript                            | iOS                                   | Android                               |
| -------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- |
| Query                            | `query`                               | `query`                               | `query`                               |
| Category IDs                     | `categoryIds`                         | `categoryIds`                         | `categoryIds`                         |
| Tags                             | `tags`                                | `tags`                                | `AmityTags`                           |
| Membership status                | `communityMembershipStatus`           | `communityMembershipStatus`           | `filter`                              |
| Discoverable private communities | `includeDiscoverablePrivateCommunity` | `includeDiscoverablePrivateCommunity` | `includeDiscoverablePrivateCommunity` |

<Note>
  The current public Flutter SDK source reviewed for this page does not expose a semantic community search repository method.
</Note>

## Search Communities

Search communities with a semantic query and optional category, tag, membership, or discoverable-private filters.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { CommunityRepository } from '@amityco/ts-sdk';

  let loadNextPage: (() => void) | undefined;
  let canLoadMore = false;

  const unsubscribe = CommunityRepository.semanticSearchCommunities(
    {
      query: 'trail running',
      categoryIds: ['category-id'],
      tags: ['outdoors'],
      includeDiscoverablePrivateCommunity: true,
      limit: 20,
    },
    ({ data: communities, onNextPage, hasNextPage, loading, error }) => {
      if (loading) return;
      if (error) {
        handleError(error);
        return;
      }

      renderResults(communities);
      loadNextPage = onNextPage;
      canLoadMore = hasNextPage;
    },
  );

  function loadMoreCommunities() {
    if (canLoadMore) {
      loadNextPage?.();
    }
  }

  unsubscribe();
  ```

  ```swift iOS theme={null}
  let options = AmityCommunitySemanticSearchOptions(
      query: "trail running",
      categoryIds: ["category-id"],
      tags: ["outdoors"],
      communityMembershipStatus: .all,
      includeDiscoverablePrivateCommunity: true
  )

  token = communityRepository
      .semanticSearchCommunities(options: options)
      .observe { collection, error in
          if let error {
              handleError(error)
              return
          }

          showSuccessMessage(collection.snapshots.count)
      }
  ```

  ```kotlin Android theme={null}
  import com.amity.socialcloud.sdk.model.social.community.AmityCommunityMembershipStatusFilter

  AmitySocialClient.newCommunityRepository()
      .semanticSearchCommunities(
          query = "trail running",
          filter = AmityCommunityMembershipStatusFilter.ALL,
          tags = AmityTags(listOf("outdoors")),
          categoryIds = listOf("category-id"),
          includeDiscoverablePrivateCommunity = true
      )
      .subscribe(
          { pagingData: PagingData<AmityCommunity> -> showSuccessMessage(pagingData) },
          { error -> handleGeneralError(error) }
      )
  ```
</CodeGroup>

## Membership Status

| Intent                                     | iOS          | Android                                           | TypeScript                                                         |
| ------------------------------------------ | ------------ | ------------------------------------------------- | ------------------------------------------------------------------ |
| Search all visible communities             | `.all`       | `AmityCommunityMembershipStatusFilter.ALL`        | Omit `communityMembershipStatus` for the default all-status search |
| Search joined communities                  | `.member`    | `AmityCommunityMembershipStatusFilter.MEMBER`     | Use the SDK's typed membership-status value in app code            |
| Search communities the user has not joined | `.notMember` | `AmityCommunityMembershipStatusFilter.NOT_MEMBER` | Use the SDK's typed membership-status value in app code            |

## Notes

* Use category and tag filters when your discovery UI already knows the user's topic area.
* Use `includeDiscoverablePrivateCommunity` only when your product intentionally exposes discoverable private communities in search results.
* Search results are returned as live or paginated collections depending on platform, so keep pagination and disposal logic close to the screen that owns the search.

## Related Topics

<CardGroup cols={3}>
  <Card title="Query Communities" href="../../communities-spaces/discovery/query-communities" icon="magnifying-glass">
    Query and search communities by membership, category, tags, keyword, and sort order.
  </Card>

  <Card title="Community Categories" href="../../communities-spaces/organization/community-categories" icon="folder">
    Retrieve categories used to organize community discovery.
  </Card>

  <Card title="Search Overview" href="./overview" icon="sparkles">
    Review SDK search surfaces for community and post discovery.
  </Card>
</CardGroup>
