Documentation
¶
Overview ¶
Package search implements grounded semantic search over active document versions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GroundedResult ¶
type GroundedResult struct {
Status GroundingStatus
Reason GroundingReason
Hits []knowledge.SearchHit
}
GroundedResult keeps the legacy hits intact while adding an explicit safety decision.
type GroundingReason ¶
type GroundingReason string
GroundingReason identifies why the retrieval substrate returned no evidence.
const ( GroundingNoHitsAbovePolicy GroundingReason = "NO_HITS_ABOVE_POLICY" GroundingOnlyInactiveVersionMatched GroundingReason = "ONLY_INACTIVE_VERSION_MATCHED" )
type GroundingStatus ¶
type GroundingStatus string
GroundingStatus is the deterministic retrieval-safety decision returned to clients.
const ( // GroundingSupported means at least one active, above-policy evidence hit is available. GroundingSupported GroundingStatus = "SUPPORTED" // GroundingInsufficientEvidence means callers must not treat the empty result as grounded evidence. GroundingInsufficientEvidence GroundingStatus = "INSUFFICIENT_EVIDENCE" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service validates, embeds, and executes grounded document searches.
func New ¶
func New( repository repository, embedder embedder, profile knowledge.Profile, publicBaseURL string, exactMatch bool, sourceVerifiers ...sourceVerifier, ) (*Service, error)
New returns a search service backed by the provided repository and embedder. exactMatch=true enables query-time exact-token refinement: when at least one returned hit's snippet contains the full query as a substring, only those hits are kept; otherwise the full semantic top-N is returned unchanged.
func (*Service) Documents ¶
func (s *Service) Documents( ctx context.Context, query string, limit int, ) ([]knowledge.SearchHit, error)
Documents returns ranked hits from active document versions only. A zero limit uses the default; other limits must be between 1 and 20.
func (*Service) GroundedDocuments ¶
func (s *Service) GroundedDocuments( ctx context.Context, query string, limit int, ) (GroundedResult, error)
GroundedDocuments returns only active, above-policy evidence and classifies every safe empty result. Retryable dependency failures become SOURCE_UNAVAILABLE with an explicit empty slice; invalid input and non-retryable configuration failures remain errors.