> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Custom-Ranking Global Feed

> How the backend scores and orders global feed posts, and how to query the ranked feed.

Use custom-ranking global feed when your app has enabled the backend-ranked global feed experience. Ranking runs on the backend — the SDK takes no weighting or sorting parameters, it only requests the custom-ranking feed and returns the posts the backend provides. See [How custom ranking orders posts](#how-custom-ranking-orders-posts) for what drives the order.

```typescript TypeScript theme={null}
import { FeedRepository } from '@amityco/ts-sdk';

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

const unsubscribe = FeedRepository.getCustomRankingGlobalFeed(
  {
    includeMixedStructure: true,
    limit: 20,
  },
  ({ data: posts, onNextPage, hasNextPage, loading, error }) => {
    if (loading) return;
    if (error) {
      handleError(error);
      return;
    }

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

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

unsubscribe();
```

```swift iOS theme={null}
token = feedRepository
    .getCustomRankingGlobalFeed(includeMixedStructure: true)
    .observe { collection, error in
        if let error {
            handleError(error)
            return
        }

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

```kotlin Android theme={null}
AmitySocialClient.newFeedRepository()
    .getCustomRankingGlobalFeed()
    .includeMixedStructure(includeMixedStructure = true)
    .build()
    .query()
    .subscribe(
        { pagingData: PagingData<AmityPost> -> showSuccessMessage(pagingData) },
        { error -> handleGeneralError(error) }
    )
```

```dart Flutter theme={null}
final page = await AmitySocialClient.newFeedRepository()
    .getCustomRankingGlobalFeed()
    .getPagingData(limit: 20);

final posts = page.data;
showError(posts.length);
```

> [!NOTE]
>
> Custom ranking is an SDK-only surface. The UIKit renders the chronological global feed on every platform — see the [Feature Matrix](/feature-matrix.md). To ship a ranked feed with the UIKit, query `getCustomRankingGlobalFeed()` yourself and render the results with your own list.

## How ranking orders posts

Chronological ordering treats every post the same, whether or not anyone engaged with it. Custom ranking sorts on a score built from *meaningful interactions*, so a post people comment on and react to outranks a post that is merely newer.

| Factor | Effect on the score |
| - | - |
| Comments | Raises the score, weighted twice as heavily as a reaction — commenting is deeper engagement |
| Reactions | Raises the score |
| Age (`createdAt`) | Decays the score over time, keeping the feed fresh |
| Updates and edits (`updatedAt`, `editedAt`) | Temporarily boosts the score, keeping revised content visible longer |

Scores are recalculated on every query, so pagination results can shift while users interact with the content.

> [!WARNING]
>
> Limitations of the custom-ranking global feed:
>
> * **Ranking delay** — a new post appears in the user feed immediately, but may take a moment to surface in the custom-ranking global feed while its score is calculated.
> * **SDK version** — only posts created with SDK version 5.10 or later are covered by custom ranking.
> * **Tuning** — the decay curve and boost windows are configured per network by the backend, not through the SDK. To tailor them, contact [social.plus Support](https://ekoapp.atlassian.net/servicedesk/customer/portal/3) with your ranking requirements.

## Parameters

| Parameter | Platforms | Required | Description |
| - | - | - | - |
| `includeMixedStructure` | All | No | Include mixed-structure posts in the backend-ranked global feed response. |
| `limit`, `onNextPage`, `hasNextPage` | TypeScript | No | Control page size and load additional pages from the live collection callback. |

> [!NOTE]
>
> Treat custom-ranking behavior as backend-owned. Do not hardcode ranking assumptions in client UI logic.

## Related Topics

> [card] [Global Feed](/social-plus-sdk/social/discovery-engagement/feed/global-feed.md)
>
> The same content in plain chronological order.

> [card] [For You Feed](/social-plus-sdk/social/discovery-engagement/feed/for-you-feed.md)
>
> Personalized per user, with its own backend-owned content sources.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.