Similar — Recipes
Three shapes for three common detail-page widgets.
Six nearest neighbors on the product detail page. Minimum score keeps the
panel quiet when neighbors get distant.
similarproducts
products: {
source: 'main',
table: 'products',
fields: {
id: { type: 'number', primaryKey: true },
name: { type: 'text', searchable: { weight: 3 } },
description: { type: 'text', searchable: true },
category: { type: 'enum', values: ['headphones', 'footwear', 'apparel'] },
brand: { type: 'text' },
},
grants: { similar: 'public' },
}
A sidebar on every doc page. Includes section as metadata so the card can
render a breadcrumb.
similararticles
articles: {
source: 'main',
table: 'articles',
fields: {
id: { type: 'number', primaryKey: true },
title: { type: 'text', searchable: { weight: 2 } },
body: { type: 'text', searchable: true },
section: { type: 'enum', values: ['security', 'billing', 'api', 'guides'] },
},
grants: { similar: 'public' },
}
Staff-only widget on the ticket view. Uses sk_ credentials and a
restrictive rule.
similartickets
tickets: {
source: 'main',
table: 'tickets',
fields: {
id: { type: 'number', primaryKey: true },
subject: { type: 'text', searchable: { weight: 2 } },
body: { type: 'text', searchable: true },
status: { type: 'enum', values: ['open', 'triaged', 'resolved'] },
priority: { type: 'enum', values: ['low', 'normal', 'high', 'urgent'] },
},
grants: { similar: 'staff' },
}
similar returns a single snapshot. If you need any of the following, reach
for a feed with recordVector:
- Popularity weighting — engagement scorer, blended with similarity.
- Diversity —
diversify: { by: 'cuisine', maxPerGroup: 2 }.
- Pagination — cursor-based scroll beyond the first page.
- Live evolution — WebSocket ticks when new candidates arrive.
Otherwise, similar is the lighter primitive — less surface area, less
config to reason about.