Skip to content

fix: Search ranking on merge indexes#2994

Merged
delucis merged 3 commits intowithastro:mainfrom
XREvo:fix-search-ranking-on-merge-indexes
Mar 21, 2025
Merged

fix: Search ranking on merge indexes#2994
delucis merged 3 commits intowithastro:mainfrom
XREvo:fix-search-ranking-on-merge-indexes

Conversation

@XREvo
Copy link
Copy Markdown
Contributor

@XREvo XREvo commented Mar 20, 2025

Description

This PR:

Test

I've tested locally with 2 variants of the starlight's documentation:

  1. The first variant is the one from the main branch, without any merged indexes nor any modifications
  2. The second one is nearly the same as the one from the main branch, with little modifications:
    1. A markdown file changed, replacing climate impact by climate exchange
    2. And a merge index pointing to the first site on pagefind configuration

To test it I searched for climate exchange (the modified text) on the second site.

Before applying the fix, search shown the original site as first result, and after the fix, modified site was first in search result (due to corp. network policies I can't upload screenshot right now to prove it)

Details

I used this script to build and serve locally the 2 variants:

#! /bin/bash

echo "Installing serve globaly"
npm i -g serve

echo "Building the documentation for port 3001"
if [ -d "dist-3001" ]; then
    rm -rf "dist-3001"
fi
pnpm build
mv dist dist-3001

echo "Changing the content of the documentation"
sed -i 's/climate impact/climate exchange/' src/content/docs/environmental-impact.md
sed -i '52i\ \t\t\tpagefind: { indexWeight: 2.0, mergeIndex: [{ bundlePath: "http://localhost:3001/pagefind/", indexWeight: 0.5, }] },' astro.config.mjs


echo "Building the documentation for port 3002"
if [ -d "dist-3002" ]; then
    rm -rf "dist-3002"
fi
pnpm build
mv dist dist-3002

echo "Serving the 2 sites"
serve -l 3001 --cors ./dist-3001 &
serve -l 3002 --cors ./dist-3002

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 20, 2025

🦋 Changeset detected

Latest commit: 8729104

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Mar 20, 2025
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 20, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 8729104
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/67dd5342af7e4a0008387bd2
😎 Deploy Preview https://deploy-preview-2994--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@XREvo XREvo marked this pull request as draft March 20, 2025 12:31
@XREvo XREvo force-pushed the fix-search-ranking-on-merge-indexes branch from 7dcadbc to 846fecd Compare March 20, 2025 12:38
@XREvo XREvo marked this pull request as ready for review March 20, 2025 12:42
Copy link
Copy Markdown
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @XREvo! Will make one small change to the comment and add a changeset.

@delucis delucis added the 🌟 patch Change that triggers a patch release label Mar 21, 2025
@delucis delucis merged commit ca4ec8b into withastro:main Mar 21, 2025
15 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Mar 21, 2025
HiDeoo added a commit to HiDeoo/starlight that referenced this pull request Mar 24, 2025
* main: (67 commits)
  [ci] format
  i18n(de): update `plugins.mdx` (withastro#2988)
  remove ghostcms plugin (withastro#2999)
  Add Starlight Markdown Blocks to community plugins (withastro#2998)
  [ci] release (withastro#2992)
  Add npm social icon (withastro#2969)
  [ci] format
  fix: Search ranking on merge indexes (withastro#2994)
  update astro to the latest version (withastro#2948)
  add own plugin and enhance some other descriptions (withastro#2996)
  chore: disable renovate dashboard (withastro#2995)
  feat(tailwind): support @astrojs/tailwind v6 (withastro#2991)
  i18n(fr): update `resources/plugins` (withastro#2990)
  i18n(ko-KR): update `plugins.mdx` (withastro#2987)
  chore: disable renovate package manager updates (withastro#2985)
  chore: disable renovate docker updates (withastro#2982)
  Update labeler config (withastro#2983)
  chore(deps): update github-actions (withastro#2979)
  [ci] format
  chore: disable automated PRs for npm (withastro#2978)
  ...
Yoxnear pushed a commit to Yoxnear/starlight-custom that referenced this pull request Jul 23, 2025
Co-authored-by: Emilien GUILMINEAU (Ext.) <emilien.guilmineau.prestataire@sfr.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌟 core Changes to Starlight’s main package 🌟 patch Change that triggers a patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default pagefind ranking weights are not applied to meged indexes

2 participants