search-config
Search indexing configuration and full-text search management
What this skill does
# Search Config - Complete API Reference
Configure search indexing, manage search backends, and optimize full-text search.
---
## Chat Commands
### View Status
```
/search-config Show search config
/search-config status Index status
/search-config stats Search statistics
```
### Index Management
```
/search-config rebuild Rebuild all indexes
/search-config rebuild memories Rebuild specific index
/search-config optimize Optimize indexes
/search-config clear <index> Clear index
```
### Configuration
```
/search-config backend sqlite Set backend
/search-config backend elasticsearch Use Elasticsearch
/search-config mode hybrid Set search mode
/search-config boost semantic 0.7 Set semantic weight
```
---
## TypeScript API Reference
### Create Search Service
```typescript
import { createSearchService } from 'clodds/search';
const search = createSearchService({
// Backend
backend: 'sqlite', // 'sqlite' | 'elasticsearch' | 'typesense' | 'meilisearch'
// Search mode
mode: 'hybrid', // 'fulltext' | 'semantic' | 'hybrid'
// Hybrid weights
semanticWeight: 0.6,
fulltextWeight: 0.4,
// Embedding provider (for semantic)
embeddings: {
provider: 'openai',
model: 'text-embedding-3-small',
},
// Storage
dbPath: './search.db',
});
```
### Index Documents
```typescript
// Index single document
await search.index({
collection: 'memories',
id: 'mem-1',
content: 'User prefers conservative trading',
metadata: {
type: 'preference',
userId: 'user-123',
},
});
// Index batch
await search.indexBatch({
collection: 'documents',
documents: [
{ id: 'doc-1', content: 'First document', metadata: {} },
{ id: 'doc-2', content: 'Second document', metadata: {} },
],
});
```
### Search
```typescript
// Full-text search
const results = await search.search({
query: 'trading strategies',
collection: 'documents',
limit: 10,
});
for (const result of results) {
console.log(`${result.id}: ${result.score}`);
console.log(` ${result.snippet}`);
}
// With filters
const results = await search.search({
query: 'bitcoin',
collection: 'news',
filters: {
date: { gte: '2024-01-01' },
source: 'reuters',
},
limit: 20,
});
```
### Hybrid Search
```typescript
// Combine full-text and semantic
const results = await search.hybridSearch({
query: 'how to manage risk in trading',
collection: 'documents',
semanticWeight: 0.7,
fulltextWeight: 0.3,
limit: 10,
});
```
### Get Index Stats
```typescript
const stats = await search.getStats();
console.log('Index Statistics:');
for (const [collection, info] of Object.entries(stats.collections)) {
console.log(`${collection}:`);
console.log(` Documents: ${info.documentCount}`);
console.log(` Size: ${info.sizeMB} MB`);
console.log(` Last indexed: ${info.lastIndexed}`);
}
console.log(`\nSearch Stats:`);
console.log(` Queries today: ${stats.queriesToday}`);
console.log(` Avg latency: ${stats.avgLatencyMs}ms`);
console.log(` Cache hit rate: ${stats.cacheHitRate}%`);
```
### Rebuild Index
```typescript
// Rebuild all indexes
await search.rebuildAll();
// Rebuild specific collection
await search.rebuild('memories');
// With progress callback
await search.rebuild('documents', {
onProgress: (progress) => {
console.log(`${progress.current}/${progress.total} (${progress.percent}%)`);
},
});
```
### Optimize Index
```typescript
// Optimize for better performance
await search.optimize();
// Optimize specific collection
await search.optimize('documents');
```
### Clear Index
```typescript
// Clear specific collection
await search.clear('memories');
// Clear all
await search.clearAll();
```
### Configure Backend
```typescript
// Switch to Elasticsearch
await search.setBackend('elasticsearch', {
url: process.env.ELASTICSEARCH_URL,
index: 'clodds',
});
// Switch to Typesense
await search.setBackend('typesense', {
url: process.env.TYPESENSE_URL,
apiKey: process.env.TYPESENSE_API_KEY,
});
```
---
## Search Backends
| Backend | Best For | Features |
|---------|----------|----------|
| **SQLite** | Development, small data | Simple, embedded |
| **Elasticsearch** | Production, large data | Scalable, powerful |
| **Typesense** | Fast search | Typo tolerance |
| **Meilisearch** | Instant search | Easy setup |
---
## Search Modes
| Mode | Description |
|------|-------------|
| `fulltext` | Traditional keyword matching |
| `semantic` | Vector similarity search |
| `hybrid` | Combined (best of both) |
---
## Hybrid Search Weights
```typescript
// More emphasis on meaning
const results = await search.hybridSearch({
query: 'risk management',
semanticWeight: 0.8, // 80% semantic
fulltextWeight: 0.2, // 20% keyword
});
// More emphasis on exact matches
const results = await search.hybridSearch({
query: 'BTCUSDT',
semanticWeight: 0.2, // 20% semantic
fulltextWeight: 0.8, // 80% keyword
});
```
---
## Best Practices
1. **Use hybrid search** — Best results for most queries
2. **Rebuild periodically** — Keep indexes fresh
3. **Optimize after bulk inserts** — Improve performance
4. **Monitor latency** — Scale if too slow
5. **Tune weights** — Adjust semantic/fulltext balance
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.