Class SearchResult

java.lang.Object
ai.vectros.types.SearchResult

public final class SearchResult extends Object
  • Method Details

    • getDocumentId

      public Optional<String> getDocumentId()
      Returns:
      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.
    • getScore

      public Optional<Double> getScore()
      Returns:
      The combined relevance score that fuses the text and semantic signals (reciprocal rank fusion). This is the primary sort key — a higher value means a more relevant result.
    • getTextScore

      public Optional<Double> getTextScore()
      Returns:
      The keyword (BM25) relevance component of the score. It is non-zero in HYBRID mode when the keyword engine contributes to the match. It is always 0 in TEXT mode, because that path does not expose per-hit scores — in TEXT mode the order of the results array is the ranking signal, not this field.
    • getSemanticScore

      public Optional<Double> getSemanticScore()
      Returns:
      The semantic (vector similarity) component of the score. Non-zero when the search mode is SEMANTIC or HYBRID.
    • getChunkText

      public Optional<String> getChunkText()
      Returns:
      The exact text chunk that matched the query. Pass this to your model as the retrieved context.
    • getContextText

      public Optional<String> getContextText()
      Returns:
      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.
    • getSnippet

      public Optional<String> getSnippet()
      Returns:
      A short excerpt with the matched query terms highlighted. Suitable for display in a search results UI.
    • getSourceType

      public Optional<SearchResultSourceType> getSourceType()
      Returns:
      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.
    • getMetadata

      public Optional<Map<String,Object>> getMetadata()
      Returns:
      The metadata you supplied for this item when you ingested it, such as its title, folder ID, and any custom fields you included.
    • getCreatedAt

      public Optional<String> getCreatedAt()
      Returns:
      When the source item was created, 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 SearchResult.Builder builder()