@tinacms/search
v1.2.6
Published
Full-text search for TinaCMS powered by [search-index](https://github.com/fergiemcdowall/search-index).
Keywords
Readme
@tinacms/search
Full-text search for TinaCMS powered by search-index.
Installation
pnpm add @tinacms/searchUsage
import { LocalSearchIndexClient } from "@tinacms/search";
const client = new LocalSearchIndexClient({
stopwordLanguages: ["eng"],
});
await client.onStartIndexing();
await client.put([
{
_id: "1",
title: "Getting Started",
body: "TinaCMS is a Git-backed headless CMS",
},
{
_id: "2",
title: "React Tutorial",
body: "Learn how to build React applications",
},
]);
// Basic search
const results = await client.query("TinaCMS", { limit: 10 });
// Fuzzy search (handles typos)
const fuzzyResults = await client.query("TinCMS tutrial", {
fuzzy: true,
limit: 10,
});API
client.onStartIndexing()- Initialize the indexclient.put(documents)- Index documentsclient.query(query, options)- Search the indexclient.del(ids)- Delete documentsclient.export(filename)- Export index to SQLite
License
Apache 2.0
