WP Manifestindependent plugin directory
manifest / performance / search-index

Search Index

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/fermain/search-index/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Generates a minimal JSON search index for your WordPress posts at:

wp-content/uploads/search/index.json

Intended for static sites exported by WP2Static (or similar). The index uses root‑relative URLs so links work after export.

Installation

  1. Copy this plugin directory into wp-content/plugins/search-index.
  2. Activate “Search Index” in WordPress → Plugins.
  3. Visit Tools → Search Index to view status, configure settings, and rebuild the index.

Output format

{
  "version": "1",
  "generatedAt": "2025-09-15T12:34:56Z",
  "items": [
    {
      "id": 123,
      "slug": "hello-world",
      "title": "Hello world",
      "content": "Stripped excerpt or full content depending on settings",
      "url": "/hello-world/",
      "categories": ["news"],
      "tags": ["intro"]
    }
  ]
}

Notes:

  • content is a 40‑word excerpt from the rendered post body (shortcodes executed, then HTML stripped).
  • Dates are intentionally omitted.
  • URLs are root‑relative.

Settings

Tools → Search Index → Settings:

  • Resource tag export: Toggle generation of resource-tags.json for front-end filtering.

Regeneration

  • Automatically rebuilds when posts are published/trashed or edited (excluding revisions/autosaves).
  • You can manually rebuild via the “Rebuild index” button.

Development

Running Tests

This plugin uses PHPUnit for unit testing. To run the tests:

  1. Install dependencies:
    composer install
  2. Run the test suite:
    ./vendor/bin/phpunit

Notes for large sites

  • The index currently loads all published posts in one query. If your site has many posts, consider sharding or adding pagination logic.