Search design

Indexes and schema

Start with the questions and data. Then choose keyword, vector, filter, relational, or graph search.

Choose fields for an index

Choose which normalized record and passage fields each index should store. CoreCortex can rebuild that projection from canonical data.

One index can hold tokenized text, embedding vectors, and exact filter fields. Hybrid search combines keyword and vector rankings from the same index.

Field roleMeaningTypical use
LexicalTokenized title or contentExact terms, citations, identifiers, BM25
VectorDense embedding with fixed dimensionsParaphrases and semantic similarity
FilterExact scalar metadata and access fieldsScope, dates, categories, tenants, ACLs

The available retrieval types

TypeWhat it doesUse it when
Lexical / BM25Ranks token and term matchesNames, codes, citations, or exact language matter
Dense vectorRanks embedding similarityQuestions paraphrase the source
HybridFuses lexical and vector candidatesThe workload mixes exact and semantic queries
FilteredApplies exact metadata and authorizationResults must obey scope, dates, policy, or tenant rules
RelationalUses typed columns, joins, and aggregationThe question is structured or analytical
Graph-assistedExpands evidenced relationships or bounded pathsReviewed multi-hop judgments show a benefit

Choose a backend after you know the required search features

TurboPuffer, PostgreSQL, Milvus, pgvector, and Ladybug run different kinds of searches. corec.yaml states which features the corpus needs. An adapter checks whether a backend provides them.

Settings such as HNSW, IVFFlat, vector distance, text analyzers, and collection tuning belong to a specific backend.

BackendRole in CoreCortex
TurboPufferNative lexical, vector, filters, and RRF
PostgreSQLFull-text, exact filters, relational queries, optional pgvector
Milvus / pgvectorVector adapters behind the extension contract
LadybugEmbedded graph projection for neighborhoods and bounded paths

Example: one hybrid search index

This index stores searchable text, a 384-number vector, and exact filter fields. The retrieval plan runs keyword and vector search, combines their rankings with RRF, and returns ten results.

yamlCoreCortex Core
indexes:
  - name: reference
    backend:
      type: turbopuffer
      connectionSecret: secret://corec/turbopuffer
    fields:
      lexical: [title, content]
      vector:
        - name: content_embedding
          dimensions: 384
      filter: [tenant_id, dataset_id, category, plan]

retrievalPlans:
  - name: reference-hybrid
    index: reference
    candidates:
      - { type: bm25, field: content, limit: 50 }
      - { type: vector, field: content_embedding, limit: 50 }
    fusion: { type: rrf, rankConstant: 60 }
    limit: 10
Continue readingCreate corec.yaml→