Implement Algolia indexing pipeline: data sync, partial updates, synonyms, and rules.
The secondary money-path workflow: keep your index in sync with source data.
Trigger: "algolia indexing", "sync data to algolia", "algolia synonyms",
"algolia rules", "algolia partial update", "algolia reindex".
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Implement Algolia indexing pipeline: data sync, partial updates, synonyms, and rules.
The secondary money-path workflow: keep your index in sync with source data.
Trigger: "algolia indexing", "sync data to algolia", "algolia synonyms",
"algolia rules", "algolia partial update", "algolia reindex".
allowed-tools
Read, Write, Edit, Bash(npm:*), Grep
version
1.7.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
["saas","search","algolia"]
compatibility
Designed for Claude Code
Algolia Core Workflow B — Indexing & Data Sync
Overview
Keep your Algolia index synchronized with your source database. Covers full reindex, incremental updates, partial updates, synonyms, and query rules.
Prerequisites
Completed algolia-install-auth setup
Familiarity with algolia-core-workflow-a (search)
Source database or API with change tracking (timestamps, events)
Instructions
Step 1: Full Reindex with replaceAllObjects
import { algoliasearch } from'algoliasearch';
const client = algoliasearch(process.env.ALGOLIA_APP_ID!, process.env.ALGOLIA_ADMIN_KEY!);
// replaceAllObjects atomically swaps index content// Internally: creates temp index → indexes all records → moves temp to target// Search continues on old data until swap is complete — zero downtimeasyncfunctionfullReindex(records: Record<string, any>[]) {
const { taskID } = await client.replaceAllObjects({
indexName: 'products',
objects: records,
batchSize: 1000, // Records per batch (default 1000)
});
await client.waitForTask({ indexName: 'products', taskID });
console.log(`Full reindex complete: ${records.length} records`);
}
Step 2: Incremental Updates with partialUpdateObject
// Synonyms help users find products with different terminologyawait client.saveSynonyms({
indexName: 'products',
synonymHit: [
// Two-way synonym: any of these terms match each other
{
objectID: 'syn-1',
type: 'synonym',
synonyms: ['laptop', 'notebook', 'portable computer'],
},
// One-way synonym: "phone" also searches for "smartphone" but not reverse
{
objectID: 'syn-2',
type: 'oneWaySynonym',
input: 'phone',
synonyms: ['smartphone', 'mobile phone', 'cell phone'],
},
// Alt correction: minor typos/variations
{
objectID: 'syn-3',
type: 'altCorrection1',
word: 'color',
corrections: ['colour'],
},
// Placeholder: replace pattern with alternatives
{
objectID: 'syn-4',
type: 'placeholder',
placeholder: '<size>',
replacements: ['small', 'medium', 'large', 'XL'],
},
],
forwardToReplicas: true,
replaceExistingSynonyms: false, // true = wipe existing first
});
Step 4: Configure Query Rules
// Rules let you pin, hide, boost, or filter results for specific queriesawait client.saveRule({
indexName: 'products',
objectID: 'rule-sale-banner',
rule: {
conditions: [{
anchoring: 'contains',
pattern: 'sale',
}],
consequence: {
// Pin a specific record to position 1promote: [{ objectID: 'promo-banner-sale', position: 0 }],
// Add automatic filterparams: {
filters: 'on_sale = true',
},
},
description: 'When user searches "sale", filter to sale items and pin banner',
enabled: true,
},
});
// Hide a product from search resultsawait client.saveRule({
indexName: 'products',
objectID: 'rule-hide-discontinued',
rule: {
conditions: [{ anchoring: 'is', pattern: '' }], // Matches all queriesconsequence: {
hide: [{ objectID: 'discontinued-product-123' }],
},
description: 'Hide discontinued product from all searches',
enabled: true,
},
});
Output
The synchronization workflow produces an atomically replaced full index or a confirmed incremental update, with every write awaited before dependent reads. Synonyms and query rules remain versioned alongside the data pipeline.