Search Ranking Documentation

Swimchain uses a transparent, fixed ranking algorithm with no personalization. Every user sees the same results for the same query. This document explains exactly how search results are ranked.

Ranking Formula

The final score for each search result is calculated as a weighted sum of four normalized factors:

score = (TEXT_RELEVANCE × 0.45) + (HEAT_DECAY × 0.3) + (ENGAGEMENT × 0.1) + (RECENCY × 0.15)
FactorWeightDescription
Text Relevance45%How well the content matches your search query
Heat (Decay)30%Content's survival probability based on decay
Engagement10%How many times the content was engaged and how recently
Recency15%How recently the content was created

Factor Normalization

Text Relevance (0-1)

Raw scores from the search engine (lunr.js) are normalized using a logarithmic scale to prevent outliers from dominating:

normalized = log(1 + rawScore) / log(1 + MAX_EXPECTED_SCORE)

Where MAX_EXPECTED_SCORE = 100. Values are clamped to [0, 1].

Heat/Decay (0-1)

Survival probability is used directly. Content below the decay threshold (6.25%) receives a score of 0:

if (survivalProbability < 0.0625) return 0; return survivalProbability;

Engagement (0-1)

Each engagement is an individual proof-of-work action that resets the content's decay timer. The engagement signal combines how many times the content was engaged with how recently it was last engaged:

countScore = min(1, engagementCount / 5) recencyScore = e^(-hoursSinceLastEngagement / 72) normalized = 0.5 × countScore + 0.5 × recencyScore

Content with no engagements returns 0.

Recency (0-1)

Exponential decay based on content age, with a 7-day half-life matching the heat decay model:

HALF_LIFE = 7 × 24 × 60 × 60 × 1000 ms ageMs = now - createdAt normalized = 2^(-ageMs / HALF_LIFE)

Why These Weights?

Text Relevance (45%)

Search should primarily return relevant results. If you search for "rust async", content about Rust async programming should rank higher than unrelated content, even if that content has more engagement.

Heat/Decay (30%)

Content that the community values (keeps alive through engagement) should rank higher. This reflects the core Swimchain principle: valuable content persists, low-quality content fades.

Engagement (10%)

Engagement is a signal of current interest. Content that has been engaged recently — each engagement an individual proof-of-work action — is likely valuable to searchers.

Recency (15%)

Newer content gets a small boost, balancing freshness against the other quality signals. This prevents search results from becoming stale.

No Personalization

Unlike traditional search engines, Swimchain does not personalize results. There is no:

  • User history tracking
  • Behavioral profiling
  • A/B testing of rankings
  • Advertiser influence
  • Editorial boosting or suppression

The ranking algorithm is deterministic: given the same query and the same content state, every user sees the same results.

Score Visibility

Every search result displays its score breakdown, showing exactly how it was ranked. This transparency allows you to:

  • Understand why results appear in a certain order
  • Verify the algorithm is working as documented
  • Make informed decisions about content quality

Source Code

The ranking algorithm is open source. You can review the implementation: