Skip to content

Loupe Search - Enhanced WordPress Search

A search enhancement plugin for WordPress that builds a fast, typo-tolerant index and exposes a developer-friendly API so you can build your own search UI. Loupe Search works out of the box with WordPress’s standard search.

Renamed from WP Loupe. Loupe Search is the successor to the WP Loupe plugin. Existing installs upgrade seamlessly, and the legacy filters, REST namespace, CLI command, and index folder still work as deprecated aliases. See Renamed from WP Loupe for details.

Requirements | Installation | Settings | Reindexing | FAQ | Building Your Own Search UI | REST API | AI Agent Integration | Filters | Docs | Changelog

Loupe Search replaces WordPress core search:

  • Queries a dedicated SQLite index instead of the posts table
  • Tolerates misspellings, and supports phrase matching and exclusion operators
  • Keeps the index in sync as content is created, updated, and deleted
  • Exposes a stable REST API for custom search experiences

Integrating with AI agents or automation? Loupe Search registers native abilities via the WordPress Abilities API.

  • Fast index-backed search for configured post types
  • Typo-tolerant matching, phrase matching, and exclusion operators
  • Per-field weighting, filterable fields, sortable fields (configured in Settings)
  • Developer-facing REST API for building custom UIs, with filters, facets, geo search, and result highlighting/snippets
  • Native AI agent integration via the WordPress Abilities API
  • PHP 8.1 or higher
  • SQLite 3.35+ (required by Loupe 0.13.x)
  • PHP extensions: pdo_sqlite, intl, mbstring
  • WordPress 6.9+

About the PHP extensions: pdo_sqlite provides the SQLite driver Loupe uses to store and query the search index; intl powers locale-aware tokenizing, collation, and typo tolerance; and mbstring ensures multibyte (UTF-8) text is handled correctly during indexing and search. All three are required, but they are enabled by default on most modern PHP installations and shared hosts, so no action is usually needed. If your host is missing one, contact them or enable it in your PHP configuration.

  1. Install from WordPress.org (not yet available — the plugin is awaiting review)

    • In your WordPress admin, go to Plugins > Add New
    • Search for “Loupe Search”
    • Click “Install Now”, then “Activate”
  2. Quick Install

    • Download loupe-search.zip
    • Upload via WordPress Plugins > Add New > Upload Plugin
  3. Composer Install

    Terminal window
    composer require soderlind/loupe-search
  4. Post-Installation

    • Activate the plugin
    • Go to Settings > Loupe Search
    • Click “Reindex” to build the initial search index (runs in batches; safe for large sites)

You can configure Loupe Search’s search behavior and performance via the WordPress admin: Settings > Loupe Search.

Select which post types to include in the search index.

Weight determines how important a field is in search results:

  • Higher weight (e.g., 2.0) makes matches in this field more important in results ranking.
  • Default weight is 1.0.
  • Lower weight (e.g., 0.5) makes matches less important but still searchable.

Filterable fields can be used to refine search results:

  • Enable this option to allow filtering search results by this field’s values.
  • Best for fields with consistent, categorized values like taxonomies, status fields, or controlled metadata.
  • Examples: categories, tags, post type, author, or custom taxonomies.

Note: Fields with highly variable or unique values (like content) make poor filters as each post would have its own filter value.

Sortable fields can be used to order search results:

  • Enable this option to allow sorting search results by this field’s values
  • Works best with numerical fields, dates, or short text values
  • Examples: date, price, rating, title

Loupe Search provides advanced configuration options to fine-tune your search experience:

  • Configure prefix search behavior. Prefix search allows finding terms by typing only the beginning (e.g., “huck” finds “huckleberry”).
  • Prefix search is only performed on the last word in a search query. Prior words must be typed out fully to get accurate results. E.g. my friend huck would find documents containing huckleberry - huck is my friend, however, would not.
  • Enable Typo Tolerance: When enabled, searches will match terms with minor spelling errors.
  • First Character Double Counting: When enabled, typos in the first character of a word will count as two errors instead of one.
  • Typo Tolerance for Prefix Search: Allows typo tolerance in partial word searches.
  • Alphabet Size: Define the size of the alphabet for typo calculations.
  • Index Length: Configure the maximum length of indexed terms.
  • Typo Thresholds: Set the minimum word length required for allowing different numbers of typos.
  • Maximum Query Tokens: Limits the number of words processed in a search query (default: 12).
  • Minimum Prefix Length: Sets the minimum character length before prefix search activates (default: 3).
  • Configure which languages the search index should optimize for. Default is English (‘en’).

These advanced settings can be accessed in the WordPress admin under Settings > Loupe Search > Advanced tab.

Reindexing rebuilds the index for your configured post types.

  • Admin UI: Settings → Loupe Search → click Reindex (runs in batches to avoid timeouts)

  • WP-CLI (recommended for large sites):

    Terminal window
    wp loupe-search reindex

    Optional flags:

    Terminal window
    wp loupe-search reindex --post-types=post,page --batch-size=1000

The search index automatically updates when content is created, modified, or deleted.

No. Loupe Search uses a separate, optimized search index and doesn’t impact your main database performance.

Can I customize what content is searchable?

Section titled “Can I customize what content is searchable?”

Yes, using filters you can control exactly what content gets indexed and how it’s searched.

Yes, you can select which post types to include in the Settings page or via filters.

Loupe Search works out of the box with WordPress’s standard search. If your theme uses the normal search flow (e.g. a search form that routes to the built-in search results page), Loupe Search will power the results automatically — no custom UI required.

Loupe Search intentionally does not ship a front-end search block/shortcode UI. If you want a custom search experience (autocomplete, filters/facets, geo, custom sorting, etc.), build the UI you want and query Loupe Search via the REST API.

Start here: docs/search-api.md

Loupe Search exposes search via REST endpoints:

  • POST /wp-json/loupe-search/v1/search (recommended; supports JSON filters, facets, geo, explicit sorting, and search-result highlighting/snippets)
  • GET /wp-json/loupe-search/v1/search?q=... (legacy; kept for backward compatibility)

The old wp-loupe/v1 namespace still works as a deprecated alias. See Renamed from WP Loupe.

Developer documentation (schema + examples + Gutenberg block example): docs/search-api.md

AI Agent Integration (WordPress Abilities API)

Section titled “AI Agent Integration (WordPress Abilities API)”

Loupe Search registers two abilities via the WordPress Abilities API (WordPress 6.9+) so AI agents and automation tools can discover and use search functionality natively — no extra configuration required:

  • loupe-search/search — Typo-tolerant full-text search across indexed post types. Supports phrase matching, exclusion, and OR operators. Publicly accessible.
  • loupe-search/get-post — Retrieve a single published post by ID. Publicly accessible.

Both abilities are discoverable through the standard WordPress Abilities registry and exposed via REST (show_in_rest).

The legacy wp-loupe/* abilities (category wp-loupe) still work as deprecated aliases. See Renamed from WP Loupe.

Upgrading from the MCP server? The experimental MCP server, token service, and WP-CLI token commands were removed in 0.8.5. See the MCP → Abilities API migration guide.

Eight filters let you change what gets indexed, how it is weighted, and how results are returned:

FilterUse it to
loupe_search_post_typesChoose which post types are indexed
loupe_search_index_protectedIndex password-protected posts
loupe_search_db_pathMove the index directory
loupe_search_field_{$field_name}Clean a core post field before indexing
loupe_search_schema_{$post_type}Add/remove fields, set weights and sorting
loupe_search_is_safely_sortable_{$post_type}Force a core field to be sortable
loupe_search_is_safely_sortable_meta_{$post_type}Correct meta-field sortability detection
loupe_search_posts_per_pageChange results per page
add_filter( 'loupe_search_post_types', function ( array $post_types ): array {
$post_types[] = 'book';
return $post_types;
} );

Filters reference → — signatures, defaults, schema options, recipes, and when to reindex.

Filters use the loupe_search_* prefix; the old wp_loupe_* names still work as deprecated aliases. See Renamed from WP Loupe.

  • PHPUnit:

    Terminal window
    composer test
  • Pest (runs using the PHPUnit config):

    Terminal window
    composer test:pest
  • Loupe Search is built upon Loupe. Loupe is licensed under the MIT license.

Loupe Search is copyright © 2024 Per Søderlind.

Loupe Search is open-source software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.

Loupe Search is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE for more information.