nlsearch

package
v1.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package nlsearch decomposes free-form text into structured search signals (OASF skills, domains, and free-text keywords) using an extractor.Extractor. It is backend-agnostic: the same decomposition runs whether the extractor is the in-process local library or a remote gRPC OASF-SDK server.

Index

Constants

View Source
const DefaultMinTaxonomyScore = 0.3

DefaultMinTaxonomyScore is the minimum semantic similarity score a skill or domain must reach to be used as a search signal. Callers can override this via DecomposeWithMinScore when a looser threshold is appropriate (e.g. routing search, where the DHT has exact taxonomy matches and recall matters more).

Variables

This section is empty.

Functions

This section is empty.

Types

type Signal

type Signal struct {
	Type  SignalType
	Value string  // query value ready to pass as RecordQuery.Value
	Score float64 // confidence score from the extractor
}

Signal is a single search signal derived from a natural-language query.

func Decompose

func Decompose(ctx context.Context, text string, ext extractor.Extractor, opts extractor.ExtractOptions) ([]Signal, error)

Decompose extracts search signals from free-form text using the given extractor, applying DefaultMinTaxonomyScore to filter weak matches. opts carries per-query options (e.g. Versions) forwarded to the extractor.

func DecomposeWithMinScore

func DecomposeWithMinScore(ctx context.Context, text string, ext extractor.Extractor, minScore float64, opts extractor.ExtractOptions) ([]Signal, error)

DecomposeWithMinScore is like Decompose but uses the given minScore threshold instead of DefaultMinTaxonomyScore.

func (Signal) QueryType

func (s Signal) QueryType() searchv1.RecordQueryType

QueryType returns the RecordQueryType to use when issuing this signal as a SearchCIDs request.

type SignalType

type SignalType int

SignalType identifies the kind of search signal extracted from free-form text.

const (
	SignalTypeSkillName  SignalType = iota // maps to RECORD_QUERY_TYPE_SKILL_NAME
	SignalTypeDomainName                   // maps to RECORD_QUERY_TYPE_DOMAIN_NAME
	SignalTypeKeyword                      // fans out to RECORD_QUERY_TYPE_NAME + RECORD_QUERY_TYPE_DESCRIPTION
)

func (SignalType) String

func (t SignalType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL