Class RagSearchResult

java.lang.Object
ai.vectros.types.RagSearchResult

public final class RagSearchResult extends Object
  • Method Details

    • getDocumentId

      public String getDocumentId()
      Returns:
      The stable identifier of the matched result (a document or a record).
    • getExternalId

      public Optional<String> getExternalId()
      Returns:
      The externalId you supplied for the source item at ingestion, if any. Null when the item was ingested without one, or when it was indexed before this field existed and hasn't been updated or reindexed since.
    • getScore

      public double getScore()
      Returns:
      Higher is more relevant, but the SCALE depends on the search mode. In HYBRID mode this is a Reciprocal Rank Fusion (RRF) value: 1/(60+rank) per leg the result appears in, summed across legs — small and tightly clustered (a hit ranked top on one leg scores ~0.016; ranked top on both, ~0.033), not a 0-1 confidence. In TEXT- or SEMANTIC-only mode, this is that engine's own native score on a different scale — never compare scores across modes.
    • getTextScore

      public Optional<Double> getTextScore()
      Returns:
      The keyword relevance component of the score. Non-zero in HYBRID mode when the keyword engine contributes to the match, and in TEXT mode. In TEXT mode this is a rank-derived value reflecting the result's relative position, not a normalized BM25 magnitude — meaningful for ordering within this response, not comparable across requests or against HYBRID/SEMANTIC scores. 0 (not null) when this match came from semantic search only.
    • getSemanticScore

      public Optional<Double> getSemanticScore()
      Returns:
      The cosine-similarity score from semantic (vector) search, from 0 to 1. 0 (not null) when this match came from keyword search only.
    • getChunkText

      public Optional<String> getChunkText()
      Returns:
      The specific chunk of text that matched the query — the narrowest snippet, useful for citation.
    • getContextText

      public Optional<String> getContextText()
      Returns:
      The wider surrounding passage supplied to the model as context — broader than chunkText to better ground the answer.
    • getSnippet

      public Optional<String> getSnippet()
      Returns:
      A display-ready snippet with the matched query terms emphasized — suitable for search-result UIs.
    • getMetadata

      public Optional<Map<String,Object>> getMetadata()
      Returns:
      Metadata you supplied on the source document, such as its title, folder id, or custom tags.
    • getCreatedAt

      public Optional<OffsetDateTime> getCreatedAt()
      Returns:
      The result's creation timestamp, as an ISO-8601 UTC timestamp.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • getAdditionalProperties

      public Map<String,Object> getAdditionalProperties()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • builder

      public static RagSearchResult.DocumentIdStage builder()