Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

typesense

БесплатноБез исполняемых скриптовНе проверен

Typesense is an open-source, typo-tolerant search engine for instant search: sub-50ms queries, filters, facets, geo search and synonyms, self-hosted or in…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Typesense

Overview

Typesense is a search server you run yourself (one binary or Docker image) or rent as Typesense Cloud. It keeps the index in RAM, corrects typos by default, and supports filtering, faceting, sorting, geo search, synonyms, curation (pinning and hiding results), joins and vector search. Clients exist for JavaScript, Python, PHP, Ruby, Go, Java and more. This skill targets Server 30.x, where synonyms and overrides moved out of the collection into top-level sets.

Instructions

Run the server

Bind the port to localhost for development, and keep the admin API key in an environment variable.

export TYPESENSE_API_KEY=dev-key-8f3a
mkdir -p "$(pwd)/typesense-data"
docker run -d --name typesense -p 127.0.0.1:8108:8108 \
  -v "$(pwd)/typesense-data":/data \
  typesense/typesense:30.2 \
  --data-dir /data --api-key="$TYPESENSE_API_KEY" --enable-cors
curl http://127.0.0.1:8108/health        # {"ok":true}

Install a client: npm install typesense (3.x) or pip install typesense (2.x). Pin the image tag; use the version your clients and docs target. Release candidates (31.0.rc*) are not for production.

Create a collection

// create-collection.mjs: define the schema
import Typesense from 'typesense';

export const client = new Typesense.Client({
  nodes: [{ host: '127.0.0.1', port: 8108, protocol: 'http' }],
  apiKey: process.env.TYPESENSE_API_KEY,
  connectionTimeoutSeconds: 5,
});

await client.collections().create({
  name: 'products',
  fields: [
    { name: 'name', type: 'string' },
    { name: 'description', type: 'string' },
    { name: 'price', type: 'float', facet: true },
    { name: 'category', type: 'string', facet: true },
    { name: 'rating', type: 'float' },
    { name: 'in_stock', type: 'bool', facet: true },
    { name: 'tags', type: 'string[]', facet: true },
  ],
  default_sorting_field: 'rating',   // optional: numeric field used to rank equal matches
});

A field must be declared in the schema to be searchable, filterable or sortable. facet: true is only needed for fields used in facet_by.

Index documents

// index-documents.mjs: bulk upsert
import { client } from './create-collection.mjs';

const documents = [
  { id: '1', name: 'MacBook Pro 14', description: 'Apple laptop with M3 chip', price: 1999, category: 'Laptops', rating: 4.8, in_stock: true, tags: ['apple', 'laptop'] },
  { id: '2', name: 'ThinkPad X1 Carbon', description: 'Lenovo business notebook', price: 1499, category: 'Laptops', rating: 4.5, in_stock: true, tags: ['lenovo', 'laptop'] },
  { id: '3', name: 'Dell U2723QE', description: '27-inch 4K monitor', price: 649, category: 'Monitors', rating: 4.6, in_stock: false, tags: ['dell', 'monitor'] },
];

const results = await client.collections('products').documents().import(documents, { action: 'upsert' });
console.log(results);   // [{ success: true }, { success: true }, { success: true }]

import returns one result per document; check each for success: false rather than assuming the call worked. Document ids are strings.

Search

// search.mjs: typo tolerance, filters, facets
import { client } from './create-collection.mjs';

const results = await client.collections('products').documents().search({
  q: 'laptp',                                   // typo is corrected
  query_by: 'name,description,tags',
  filter_by: 'price:<2000 && in_stock:true',
  sort_by: 'rating:desc',
  facet_by: 'category,tags',
  per_page: 10,
  page: 1,
});
console.log(results.found, results.hits.map(h => h.document.name));
// 2 [ 'MacBook Pro 14', 'ThinkPad X1 Carbon' ]

Python:

# search.py
import os
import typesense

client = typesense.Client({
    'nodes': [{'host': '127.0.0.1', 'port': '8108', 'protocol': 'http'}],
    'api_key': os.environ['TYPESENSE_API_KEY'],
    'connection_timeout_seconds': 5,
})

results = client.collections['products'].documents.search({
    'q': 'laptop',
    'query_by': 'name,description',
    'filter_by': 'price:<2000',
    'sort_by': 'rating:desc',
})
for hit in results['hits']:
    print(hit['document']['name'], hit['document']['price'])

Geo search

Add { name: 'location', type: 'geopoint' } to the schema and store [lat, lng]:

const nearby = await client.collections('stores').documents().search({
  q: '*',
  query_by: 'name',
  filter_by: 'location:(48.8566, 2.3522, 10 km)',
  sort_by: 'location(48.8566, 2.3522):asc',
});

Synonyms and curation (v30 sets API)

Since v30 synonyms and overrides are top-level sets that you link to collections. The old collections(...).synonyms() and .overrides() calls and the synonyms:* and overrides:* API key actions no longer work (404 or 401); existing data is migrated on upgrade, so take a snapshot first.

// synonyms-and-curation.mjs
import { client } from './create-collection.mjs';

await client.synonymSets('laptop-synonyms').upsert({
  items: [{ id: 'l
Полный SKILL.md на GitHub

Установить typesense в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл typesense?

Typesense is an open-source, typo-tolerant search engine for instant search: sub-50ms queries, filters, facets, geo search and synonyms, self-hosted or in Typesense Cloud. Use when a user wants to run Typesense with Docker, define a collection schema, index documents, search from Node.js or Python, add synonyms or pinned results, create search-only API keys, or replace Algolia or Elasticsearch for site search.

Как установить скилл typesense?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл typesense запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить typesense с