Search by

soderlind / loupe-cross-site-search

soderlind

Cross-site search for WordPress multisite, built on top of Loupe Search. Maintains one combined Loupe index across participating sites and exposes a search endpoint on a hub site.

Package info

github.com/soderlind/loupe-cross-site-search

Type:wordpress-plugin

pkg:composer/soderlind/loupe-cross-site-search

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 19

1.3.0 2026-11-13 14:18 UTC

This package is auto-updated.

Last update: 2026-11-14 22:13:18 UTC


README

Cross-site search for WordPress multisite, built as an add-on to Loupe Search. It maintains one combined Loupe index across the sites in your network and exposes a single search endpoint on a designated hub site, so a visitor can search every participating site at once and get one ranked list of results.

How it works

  • Combined index. Instead of querying each site's index at search time, the add-on mirrors documents from every participating site into a single index (one Loupe database per post type) stored at a network-global path. Ranking and pagination are then a single, native operation. (ADR 0001)
  • In-context mirroring, no switch_to_blog. Each site mirrors its own posts into the combined index from within its own request context, reusing Loupe Search's document builder so per-site options and filters apply. Backfill runs each site in its native context via a separate WP-CLI bootstrap. (ADR 0002)
  • Composite identity. Documents are keyed {blog_id}_{post_id} and store blog_id, blog_name, and url, so results carry site attribution and link correctly across the network.
  • Public, published content only. Mirrors what Loupe Search itself exposes.
  • Complete search block. A ready-to-use Cross-Site Search block ships with the plugin: site and post-type facets, sorting, highlighted snippets, pagination, and result attribution — all configurable in the block inspector.

Design decisions are recorded in docs/adr/ and the domain glossary in CONTEXT.md.

Requirements

  • WordPress multisite 7.0+
  • Loupe Search 1.4.0 or later, active on the network
  • PHP 8.3+ with pdo_sqlite, intl, mbstring (same as Loupe Search)

Installation

  1. Download loupe-cross-site-search.zip

  2. Go to Network Admin → Plugins and upload loupe-cross-site-search.zip, then activate the plugin network-wide.

  3. Go to Network Admin → Settings → Cross-Site Search and configure the hub site, participation, language, and post types.

  4. Build the combined index:

    wp loupe-cross-site reindex

Once installed, the plugin updates itself from GitHub releases (via soderlind/wordpress-github-updater) — new releases appear on the WordPress Plugins update screen.

Configuration

Network Admin → Settings → Cross-Site Search

Setting Description
Hub site The site that exposes the cross-site search REST endpoint. Defaults to the network's main site.
Participation All public sites, an allowlist, or a blocklist of sites.
Index language Two-letter code used to tokenize the combined index (single language for the whole index). (ADR 0004)
Post types Which post types are mirrored into the combined index.

After changing participation, language, or post types, run wp loupe-cross-site reindex.

Search block

The plugin ships a ready-to-use Cross-Site Search block. Add it to any page or post on the hub site (or any same-origin site) and visitors can search the whole network from the front end — no code required.

Features

  • Debounced search-as-you-type with a clear button and loading state.
  • Facets for site and post type (checkboxes with live counts) that filter the results; a "Clear filters" control appears when any are active.
  • Sorting: Relevance, Newest, Oldest, or Title.
  • Highlighting of matched terms with cropped snippets (<mark>), sanitized before rendering.
  • Per-result site badge, post-type label, and date.
  • Pagination and a result count with query timing.
  • Empty, loading, and error states with ARIA live regions.

Inspector settings

Setting Default Description
Heading — Optional heading above the search box
Placeholder Search… Search input placeholder
Results per page 10 Between 1 and 50
Site filter on Show the site facet
Post type filter on Show the post-type facet
Sorting on Show the sort control
Default sort Relevance Relevance / Newest / Oldest / Title
Show excerpt on Render highlighted snippets
Show date on Show each result's date
Highlight matches on Request and render match highlighting

On subdomain multisite the block makes a cross-origin request to the hub; place it on the hub site, use a subdirectory network, or add CORS headers. Prefer building your own UI? Query the REST API directly — see the developer guide.

Developer documentation

The REST API, search block, WP-CLI commands, extension filters, and test commands are documented in the developer guide. See also the architecture overview, decisions, and the domain glossary in CONTEXT.md.

License

GPL-2.0-or-later. Copyright © Per Søderlind.