Files
wehub-resource-sync a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:33:42 +08:00

29 lines
1.1 KiB
Go

package mcp
import (
"github.com/zzet/gortex/internal/config"
"github.com/zzet/gortex/internal/search"
)
// SetSearchConfig installs the `.gortex.yaml::search` block on the
// server. Called by the server / daemon entrypoint right after
// NewServer, alongside SetArtifacts / SetNamedQueries. The block
// supplies the keyword-soup rewrite mode, equivalence-class
// expansion settings, and the prose-indexing toggle consumed by the
// search handlers. A no-op-friendly zero value keeps every knob at
// its documented default.
func (s *Server) SetSearchConfig(cfg config.SearchConfig) {
s.searchCfg = cfg
// Build the curated equivalence table once, merging in any
// repo-custom classes. Cheap and immutable -- safe to do here
// rather than lazily, and no lock is needed afterwards.
s.equivalence = search.NewEquivalenceTable(cfg.EquivalenceExtra)
}
// searchConfig returns the installed search config. The zero value is
// valid -- every accessor on config.SearchConfig folds an empty field
// into its default.
func (s *Server) searchConfig() config.SearchConfig {
return s.searchCfg
}