soderlind / wp-loupe
Search engine for WordPress. It uses the Loupe search engine to create a search index for your posts and pages and to search the index.
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 50
Watchers: 2
Forks: 0
Open Issues: 2
Type:wordpress-plugin
Requires
- ext-pdo: *
- loupe/loupe: ~0.9.0
This package is auto-updated.
Last update: 2025-02-28 05:38:29 UTC
README
A powerful search enhancement plugin for WordPress that delivers fast, accurate, and typo-tolerant search results.
Quick Links
Features | Installation | Usage | FAQ | Filters | Changelog | TODO
Overview
WP Loupe transforms WordPress's search functionality by:
- Creating a dedicated search index for lightning-fast results
- Supporting typo-tolerant searches
- Offering phrase matching and advanced search operators
- Automatically maintaining the search index
- Providing customization options for developers
Features
Core Features
- π Enhanced search engine replacing WordPress default
- β‘ Lightning-fast, precise result delivery
- π Real-time index synchronization
- π Support for multiple languages
- π¦ Full custom post type integration
- π Integrated search performance metrics
- β Seamless compatibility with WordPress default themes
Search Capabilities
- π Typo-tolerant searching
- "..." Phrase matching with quotation marks
-
Exclusion operator support- π Pagination support
Developer Features
- π οΈ Extensive filter system
- π Performance monitoring
- π§ Customizable indexing
Installation
-
Quick Install
- Download
wp-loupe.zip
- Upload via WordPress Plugins > Add New > Upload Plugin
- Download
-
Composer Install
composer require soderlind/wp-loupe
-
Post-Installation
- Activate the plugin
- Go to Settings > WP Loupe
- Click "Reindex" to build the initial search index
Usage
Basic Search
- Type normally in your search box
- Results are instant and typo-tolerant
- Matches are highlighted in results
Advanced Search Operators
Hello World
will search for posts containingHello
orWorld
."Hello World"
will search for posts containing the phraseHello World
.Hello -World
will search for posts containingHello
but notWorld
.
FAQ
How does it handle updates to posts?
The search index automatically updates when content is created, modified, or deleted.
Will it slow down my site?
No. WP Loupe uses a separate, optimized search index and doesn't impact your main database performance.
Can I customize what content is searchable?
Yes, using filters you can control exactly what content gets indexed and how it's searched.
Does it work with custom post types?
Yes, you can select which post types to include in the Settings page or via filters.
Filters
wp_loupe_db_path
: This filter allows you to change the path where the Loupe database files are stored. By default, it's in theWP_CONTENT_DIR .'/wp-loupe-db'
directory.
add_filter( 'wp_loupe_db_path', WP_CONTENT_DIR . '/my-path' );
wp_loupe_post_types
: This filter allows you to modify the array of post types that the WP Loupe plugin works with. By default, it includes 'post' and 'page'.
add_filter( 'wp_loupe_post_types', [ 'post', 'page', 'book' ] );
wp_loupe_filterable_attribute_{$post_type}
: This dynamic filter allows you to modify the array of filterable attributes for each post type. By default, it includes 'post_title' and 'post_content'.
add_filter( "wp_loupe_filterable_attribute_book", [ 'post_title', 'author', 'isbn' ] );
wp_loupe_posts_per_page
: This filter allows you to modify the number of search results per page. By default it's 10, set inWPAdmin->Settings->Reading->"Blog pages show at most"
.
add_filter( 'wp_loupe_posts_per_page', 20 );
wp_loupe_index_protected
: This filter allows you to index posts and pages that are protected by a password. By default, it's set tofalse
.
add_filter( 'wp_loupe_index_protected','__return_true' );
wp_loupe_schema_content
: This filter allows you to modify the content before it's indexed. By default, removes HTML comments from content (i.e. remove WordPress block comments).
add_filter('wp_loupe_schema_content', function($content) { // Modify content before indexing $content = preg_replace('/<!--(.*?)-->/s', '', $content); return $content; });
Acknowledgements
WP Loupe is built upon Loupe. Loupe is licensed under the MIT license.
Copyright and License
WP Loupe is copyright Β© 2024 Per SΓΈderlind.
WP Loupe 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.
WP Loupe 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.