Skip to main content

Search With Typesense by Codemanas

This documentation covers the Search With Typesense integration implemented in the includes/Integrations/SearchWithTypesense.php file and the [typesense_instantsearch] shortcode declared in includes/Integrations/Typesense/InstantSearchShortcode.php.


Overview

The Typesense integration enables fast, typo-tolerant search capabilities for your WordPress site using the Typesense search engine. It provides a seamless way to index and search your content, enhancing the user experience with instant search results.


SearchWithTypesense Integration

File: includes/Integrations/SearchWithTypesense.php

Features

  • Integrates with the existing Search With Typesense plugin by CodeManas
  • Allows to select a full site search option when choosing post types in the native Search With Typesense interface.
  • Adds a Typesense Server Dashboard to inspect and manage the actual Typesense server.

[typesense_instantsearch] Shortcode

File: includes/Integrations/Typesense/InstantSearchShortcode.php

Purpose

Instantiates a Typesense search on the widget page.

Usage

Add the shortcode to any page or post to setup the search:

[typesense_instantsearch]

Optional Attributes

  • post_types: Choose the post types to include in this page's search.
  • hits_per_page: Add the number of hits per page that this should default to.
  • search_box: Whether to render a search box by default.

Example:

[instantsearch_widget post_types="post,page" hits_per_page="10"]

Output

  • Renders an optional search input and instantiates the JavaScript object.

typesense_widget Shortcode

Renders Instant Search widgets that integrate with the on page existing Typesense search instantiated by the shortcode above.

Attributes

The shortcode takes all of the built-in Instant Search widget attributes in snake case.

Usage

[typesense_widget type="searchBox" show_reset="false" show_submit="false"]