Annotation Interface VectorSearch


@Target(METHOD) @Retention(RUNTIME) @Documented public @interface VectorSearch
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Table containing the vector column.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    Beam size hint for vector search accuracy (maps to SET LOCAL vector_search_beam_size).
    Columns to SELECT alongside the distance.
    int
    Maximum number of results to return.
    Distance metric for similarity comparison.
    Prefix columns for the vector index (CockroachDB v26.2+).
    Name of the method parameter that holds the query vector (float[]).
    boolean
    Run inside a read-only transaction for consistency.
    Column name storing the vector embeddings.
  • Element Details

    • table

      String table
      Table containing the vector column.
    • vectorColumn

      String vectorColumn
      Column name storing the vector embeddings.
      Default:
      "embedding"
    • metric

      Distance metric for similarity comparison.
      Default:
      COSINE
    • limit

      int limit
      Maximum number of results to return.
      Default:
      10
    • queryParam

      String queryParam
      Name of the method parameter that holds the query vector (float[]).
      Default:
      "queryVector"
    • columns

      String[] columns
      Columns to SELECT alongside the distance. Empty = all columns.
      Default:
      {}
    • readOnly

      boolean readOnly
      Run inside a read-only transaction for consistency.
      Default:
      true
    • beamSize

      int beamSize
      Beam size hint for vector search accuracy (maps to SET LOCAL vector_search_beam_size). 0 = use database default.
      Default:
      0
    • prefixColumns

      String[] prefixColumns
      Prefix columns for the vector index (CockroachDB v26.2+).

      Prefix columns enable pre-filtering in the vector index itself, avoiding a full scan. They must appear before the vector column in the CREATE VECTOR INDEX statement.

      Example: prefixColumns = {"tenant_id"} generates:

      CREATE VECTOR INDEX ON table (tenant_id, embedding vector_cosine_ops)
      Default:
      {}