Quickstart Guide
Get up and running with TaylorType in 5 minutes. By the end of this guide, you'll have a working search index.
Prerequisites: You'll need a TaylorType account. Sign up for free if you haven't already.
Install the SDK
Install the TaylorType SDK for your language of choice:
npm install @taylortype/sdk
# or
yarn add @taylortype/sdk
pip install taylortype
gem install taylortype
go get github.com/taylortype/taylortype-go
Get Your API Key
Navigate to your TaylorType Dashboard and create an API key. You'll find this under Settings → API Keys.
Security Note: Never expose your API key in client-side code. Use environment variables and server-side requests.
Initialize the Client
Create a TaylorType client instance with your API key:
import { TaylorType } from '@taylortype/sdk';
const client = new TaylorType({
apiKey: process.env.TAYLORTYPE_API_KEY
});
from taylortype import TaylorType
import os
client = TaylorType(
api_key=os.environ['TAYLORTYPE_API_KEY']
)
Create an Index
An index holds your searchable data. Create one for your content type:
const index = await client.createIndex({
name: 'products',
settings: {
semantic: true,
language: 'en'
}
});
console.log(`Created index: ${index.id}`);
index = client.create_index(
name='products',
settings={
'semantic': True,
'language': 'en'
}
)
print(f"Created index: {index.id}")
Add Documents
Push your data to the index. Each document needs a unique id:
await client.index('products').addDocuments([
{
id: '1',
title: 'Wireless Noise-Canceling Headphones',
description: 'Premium over-ear headphones with active noise cancellation',
price: 299.99,
category: 'Electronics'
},
{
id: '2',
title: 'Mechanical Keyboard',
description: 'RGB backlit mechanical keyboard with Cherry MX switches',
price: 149.99,
category: 'Electronics'
},
{
id: '3',
title: 'Ergonomic Office Chair',
description: 'Adjustable lumbar support chair for all-day comfort',
price: 449.99,
category: 'Furniture'
}
]);
console.log('Documents indexed!');
client.index('products').add_documents([
{
'id': '1',
'title': 'Wireless Noise-Canceling Headphones',
'description': 'Premium over-ear headphones with active noise cancellation',
'price': 299.99,
'category': 'Electronics'
},
{
'id': '2',
'title': 'Mechanical Keyboard',
'description': 'RGB backlit mechanical keyboard with Cherry MX switches',
'price': 149.99,
'category': 'Electronics'
},
{
'id': '3',
'title': 'Ergonomic Office Chair',
'description': 'Adjustable lumbar support chair for all-day comfort',
'price': 449.99,
'category': 'Furniture'
}
])
print('Documents indexed!')
Search!
Run your first search query. Try a natural language query to see semantic search in action:
const results = await client.index('products').search({
query: 'comfortable chair for working from home',
limit: 10
});
console.log(`Found ${results.total} results:`);
results.hits.forEach(hit => {
console.log(`- ${hit.document.title} (score: ${hit.score})`);
});
// Output:
// Found 1 results:
// - Ergonomic Office Chair (score: 0.94)
results = client.index('products').search(
query='comfortable chair for working from home',
limit=10
)
print(f"Found {results.total} results:")
for hit in results.hits:
print(f"- {hit.document['title']} (score: {hit.score})")
# Output:
# Found 1 results:
# - Ergonomic Office Chair (score: 0.94)
Notice: The query "comfortable chair for working from home" found the "Ergonomic Office Chair" even though those exact words weren't in the document. That's semantic search in action!
Congratulations!
You've just built your first TaylorType search implementation. From here, you can: