feat: add DB-backed scanner entrypoint and compute-only main hook
Implements ScanArtist/ScanAll in internal/scanner loading local/external releases via the database layer with ctx-cancellation checks, plus a compute-only run() hook that logs missing-release counts. Add table-driven tests using in-memory SQLite fixtures.
This commit is contained in:
@@ -10,6 +10,20 @@ import (
|
||||
"naviwatcher/internal/normalize"
|
||||
)
|
||||
|
||||
// DefaultThreshold is the fallback similarity threshold used when a caller
|
||||
// passes threshold == 0. It matches config.Scanner.FuzzyThreshold default.
|
||||
const DefaultThreshold = 0.85
|
||||
|
||||
// resolveThreshold returns the provided threshold, or DefaultThreshold when
|
||||
// the caller passes zero (unset). This keeps the engine usable when config
|
||||
// defaults are not threaded through explicitly.
|
||||
func resolveThreshold(threshold float64) float64 {
|
||||
if threshold == 0 {
|
||||
return DefaultThreshold
|
||||
}
|
||||
return threshold
|
||||
}
|
||||
|
||||
// Similarity returns a normalized similarity score in the range [0.0, 1.0]
|
||||
// between two strings. The strings are normalized first (lowercased,
|
||||
// bracketed/parenthesized content and years stripped, special characters
|
||||
|
||||
Reference in New Issue
Block a user