Class SearchResult.Builder

java.lang.Object
ai.vectros.types.SearchResult.Builder
Enclosing class:
SearchResult

public static final class SearchResult.Builder extends Object
  • Method Details

    • from

      public SearchResult.Builder from(SearchResult other)
    • documentId

      public SearchResult.Builder documentId(Optional<String> documentId)

      The ID of the source document or record this chunk belongs to. Use it with GET /v1/documents/{id} or GET /v1/records/{id} (depending on sourceType) to retrieve the full item.

    • documentId

      public SearchResult.Builder documentId(String documentId)
    • externalId

      public SearchResult.Builder externalId(Optional<String> externalId)

      The externalId you supplied for the source item at ingestion, if any. Null when the item was ingested without one, or when the source item was indexed before this field existed and hasn't been updated or reindexed since.

    • externalId

      public SearchResult.Builder externalId(String externalId)
    • score

      public SearchResult.Builder score(Optional<Double> score)

      The primary sort key — a higher value means a more relevant result — but its SCALE depends on mode. In HYBRID mode this is a Reciprocal Rank Fusion (RRF) value: 1/(60+rank) per leg the result appears in, summed across legs, so it is small and tightly clustered (a hit ranked top on one leg scores ~0.016; ranked top on both, ~0.033) and is NOT a 0-1 confidence — don't threshold against it as one. In TEXT- or SEMANTIC-only mode, this is that engine's own native score (roughly a 0-1 cosine similarity for SEMANTIC) on a genuinely different scale — never compare scores across modes.

    • score

      public SearchResult.Builder score(Double score)
    • textScore

      public SearchResult.Builder textScore(Optional<Double> textScore)

      The keyword (BM25) relevance component of the score. Non-zero in HYBRID mode when the keyword engine contributes to the match. In TEXT mode this is a rank-derived value reflecting the result's relative position, not a raw BM25 magnitude — treat it as meaningful for ordering within this response, not as a score comparable across requests or against other modes.

    • textScore

      public SearchResult.Builder textScore(Double textScore)
    • semanticScore

      public SearchResult.Builder semanticScore(Optional<Double> semanticScore)

      The semantic (vector similarity) component of the score. Non-zero when the search mode is SEMANTIC or HYBRID.

    • semanticScore

      public SearchResult.Builder semanticScore(Double semanticScore)
    • chunkText

      public SearchResult.Builder chunkText(Optional<String> chunkText)

      The exact text chunk that matched the query. Pass this to your model as the retrieved context.

    • chunkText

      public SearchResult.Builder chunkText(String chunkText)
    • contextText

      public SearchResult.Builder contextText(Optional<String> contextText)

      A broader passage surrounding the matched chunk. Use this instead of chunkText when you need more context — for example to avoid fragmentation when building a long-context prompt for a model.

    • contextText

      public SearchResult.Builder contextText(String contextText)
    • snippet

      public SearchResult.Builder snippet(Optional<String> snippet)

      A short excerpt with the matched query terms highlighted. Suitable for display in a search results UI.

    • snippet

      public SearchResult.Builder snippet(String snippet)
    • sourceType

      public SearchResult.Builder sourceType(Optional<SearchResultSourceType> sourceType)

      Indicates what kind of source item this result came from: PartnerDocument for documents ingested via POST /v1/documents or POST /v1/documents/upload, and GenericRecord for typed records created via POST /v1/records. Use this to branch when rendering a mix of documents and records from a unified search.

    • sourceType

      public SearchResult.Builder sourceType(SearchResultSourceType sourceType)
    • metadata

      public SearchResult.Builder metadata(Optional<Map<String,Object>> metadata)

      The metadata you supplied for this item when you ingested it, such as its title, folder ID, and any custom fields you included.

    • metadata

      public SearchResult.Builder metadata(Map<String,Object> metadata)
    • createdAt

      public SearchResult.Builder createdAt(Optional<String> createdAt)

      When the source item was created, as an ISO-8601 UTC timestamp.

    • createdAt

      public SearchResult.Builder createdAt(String createdAt)
    • build

      public SearchResult build()
    • additionalProperty

      public SearchResult.Builder additionalProperty(String key, Object value)
    • additionalProperties

      public SearchResult.Builder additionalProperties(Map<String,Object> additionalProperties)