plugin search - nself-org/cli GitHub Wiki

Search Plugin

Full-text search with PostgreSQL FTS and MeiliSearch. Free, MIT licensed.

Install

nself plugin install search

What It Does

Adds full-text search to your ษณSelf backend with two engines: built-in PostgreSQL FTS for simple search, and MeiliSearch for typo-tolerant, faceted search. Provides an index management API to define which Postgres tables and columns to index, and a unified search API that queries either engine.

Configuration

Env Var Default Description
SEARCH_PORT 3302 Search service port
SEARCH_ENGINE meilisearch Engine: meilisearch or postgres
SEARCH_AUTO_INDEX true Auto-index on data changes
MEILISEARCH_HOST http://meilisearch:7700 MeiliSearch endpoint
MEILISEARCH_MASTER_KEY โ€” MeiliSearch master key

Ports

Port Purpose
3302 Search service REST API
7700 MeiliSearch (if SEARCH_ENGINE=meilisearch)

Database Tables

5 tables added to your Postgres database:

  • np_search_indices, index definitions
  • np_search_index_fields, indexed fields per index
  • np_search_documents, cached document store
  • np_search_queries, query analytics
  • np_search_synonyms, search synonym mappings

Nginx Routes

Route Target
/search/ Search API

API

GET  /health              โ€” Health check
POST /indices             โ€” Create an index
POST /indices/{name}/sync โ€” Sync Postgres table to index
GET  /search?q={query}    โ€” Search across all indices
GET  /search/{index}?q=   โ€” Search a specific index