Findstr Plugin Documentation

FindStr

Description

FindStr is a WordPress plugin that allows you to index your content in Meilisearch and display the results in your template. It is a simple and efficient way to add a powerful search engine to your WordPress website.

Findstr also allows you to create facets and filters to refine your search results or to create filtered listings.

This plugin is a work in progress, and we are open to any suggestions or contributions.

Features

  • Index your content in Meilisearch, with a simple and intuitive interface.
  • Add a Gutenberg block to display the search form in any pages.
  • Create fields to display with an easy-to-use interface.
  • Weight management based on post type.
  • Many actions and filters to customize the behavior of the search engine.

Roadmap

  • Synonyms management.
  • Add more options to the search form block.
  • Add block to display facets and filters.
  • Add more options to the weight management.

Requirements

  • WordPress 6.2 or higher
  • PHP 7.4 or higher
  • Meilisearch 1.2.0 or higher
  • A functioning Meilisearch server, with an index created, a public and private key created.

Installation

Install the plugin as any other WordPress plugin.

Indexing content

  1. Set up the plugin in WordPress admin panel : host, index, private and public key Alternatively, you can set up the plugin with the following constants in wp-config.php :
    define( 'FINDSTR_SERVER_SETTINGS', array(
        'serverUrl'     => '', // server host
        'indexUID'      => '', // index name
        'publicKeyUid'  => '', // public Key UID (Optional)
        'publicKey'     => '', // public Key
        'privateKey'    => '', // private Key
    ) );
    
  2. In tab "Index Settings", Set the Post type and fields to index
  3. In tab "Fields", create the fields you want to display in the search results
  4. Hit the "Index" button to index the content

Displaying results in template

Minimal example :

<?php 
// Init group with a unique name.
$findstr = findstr( 'main_group' );

// Display the field. (the field must be created in admin panel)
$findstr->display_field( 'search' );
$findstr->display_field( 'post_type' );

// Display the results
$findstr->display_results();

More templating examples in Frontend Templating