SemiLayerDocs

Search — Recipes

Four shapes for four real apps. Copy the block that matches your use case and adapt from there.

Product catalog

Shoppers typing "wireless noise cancelling headphones" or "durable hiking boots."

searchproducts
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: { search: 'public' },
}

Docs / articles

Documentation search — long bodies, weighted titles, section metadata.

searcharticles
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: { search: 'public' },
}

People directory

"Who knows Rust and has worked on payments."

searchpeople
people: {
  source: 'main',
  table: 'employees',
  fields: {
    id:     { type: 'number', primaryKey: true },
    name:   { type: 'text',   searchable: { weight: 2 } },
    bio:    { type: 'text',   searchable: true },
    skills: { type: 'text',   searchable: true },
    team:   { type: 'enum',   values: ['infra', 'payments', 'growth', 'support'] },
  },
  grants: { search: 'org-members' },
}

Support tickets

Triage inbox — "anyone else seeing this."

searchtickets
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', 'archived'] },
    priority: { type: 'enum',   values: ['low', 'normal', 'high', 'urgent'] },
  },
  grants: { search: 'staff' },
}