Giter Club home page Giter Club logo

wp-loupe's Introduction

WP Loupe Plugin

Features | Installation | Usage | Filters | Acknowledgements | License

Overview

WP Loupe is a plugin for WordPress that significantly improves the search capabilities of your website. It leverages a custom search index to deliver quick and precise search results.

WP Loupe employs the Loupe search engine to construct a search index for your posts and pages. The search index is stored in a SQLite database, which is automatically updated when a post or page is created or updated.

Key Features

(This is my to-do list, not all features are implemented yet)

  • Automatic update of search index upon creation or modification of a post or page.
  • Tolerant to typos (based on the State Set Index Algorithm and Levenshtein)
  • Supports phrase search using " quotation marks
  • Supports stemming
  • Utilizes stop words from the WordPress translation, e.g., Norwegian bokmål.
  • Auto-detects languages
  • Option to reindex all posts and pages from the admin interface (Settings > WP Loupe).
  • Compatible with the theme's search.php template. Tested with Twenty Twenty-Four.
  • Supports custom post types.
  • Adds processing time, as a comment, to the footer.
  • Supports translation. .pot file is included in the languages folder.
  • Delete posts and pages from the search index when they are deleted.
  • Multisite support, including the option to index all sites in a network.
  • Multisite support. Select which sites to index.
  • Multisite support. Select which site to do search from.
  • (Under consideration) Supports filtering (and ordering) on any attribute with any SQL-inspired filter statement

Installation Methods

  • Manual installation via command line using git and composer.
  • Installation using composer require soderlind/wp-loupe
  • Download the latest release wp-loupe.zip file, unzip, and upload to your plugins folder.
  • Download the latest release wp-loupe.zip file and install from the WordPress admin interface (Plugins > Add New > Upload Plugin).
  • Install directly from the WordPress admin interface (Plugins > Add New > Search for "WP Loupe").

The wp-loupe.zip file can be found in the "Assets" section of the latest release.

After installation, activate the plugin and navigate to Settings > WP Loupe to reindex all posts and pages.

How to Use

  • The search index is automatically updated when a post or page is created or updated.
  • To add older posts or pages to the search index, navigate to Settings > WP Loupe, check the reindex box and click the "Save changes" button.
  • Add custom post types to the search index by selecting the post type in the Settings > WP Loupe admin page, or by adding the post type to the wp_loupe_post_types filter (see below).

Filters

  1. wp_loupe_db_path: This filter allows you to change the path where the Loupe database files are stored. By default, it's in the WP_CONTENT_DIR .'/wp-loupe-db' directory.
add_filter( 'wp_loupe_db_path', WP_CONTENT_DIR . '/my-path' );
  1. 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' ] );
  1. 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 'title' and 'content'.
add_filter( "wp_loupe_filterable_attribute_book", [ 'title', 'author', 'isbn' ] );

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.

wp-loupe's People

Contributors

soderlind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wp-loupe's Issues

You need at least version "3.16.0" of SQLite.

I get that error after enabling the plugin:

Fatal error: Uncaught InvalidArgumentException: You need at least version "3.16.0" of SQLite.

There should be a safety check before initialize to avoid a fatal crash that required to rename the plugin folder.

Unable to Include Plugin as a Module via Composer

Hi Per,

I don't know if you remember me, but I very well since you are one of the first who ever accepted me a PR, I thank you very much for that!

I came across this plugin, and it caught my attention immediately as it seems to be exactly what I need to enhance a Gutenberg block with live search functionality. Currently, the block is functional, but with this script, it could really take it to the next level.

search2

However, here's where the problem arises. I attempted to include it using Composer, but being a WordPress Plugin, it doesn't work as expected. I wanted to inquire whether it's possible to separate the "core" functionality of the plugin into a script that I can require, or if you have any suggestions on how to achieve this. I'm open to any ideas or guidance you might have.

Again, Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.