diff --git a/cmd/core-runtime/main.go b/cmd/core-runtime/main.go index 0d7772a..43a5c94 100644 --- a/cmd/core-runtime/main.go +++ b/cmd/core-runtime/main.go @@ -1838,8 +1838,11 @@ func researchFindingMatchesIntent(query string, finding epistemics.ResearchFindi if len(routeTerms) < 2 { return true } + // A route-looking URL or page title alone is not enough for a human-facing + // answer: the displayed excerpt itself must support both endpoints. + excerptEvidence := strings.ToLower(finding.Excerpt.Text) for _, term := range routeTerms { - if !strings.Contains(evidence, term) { + if !strings.Contains(excerptEvidence, term) { return false } } diff --git a/cmd/core-runtime/main_test.go b/cmd/core-runtime/main_test.go index 89f2d75..db5eb1c 100644 --- a/cmd/core-runtime/main_test.go +++ b/cmd/core-runtime/main_test.go @@ -52,7 +52,7 @@ func TestNearestFlightEvidenceRequiresBothRouteEndpointsWhenKnown(t *testing.T) if !researchFindingMatchesIntent(query, matched) { t.Fatal("route evidence with both endpoints was rejected") } - unrelated := epistemics.ResearchFinding{Source: epistemics.Source{Title: "Ближайшие города к Казани"}, Excerpt: epistemics.SourceExcerpt{Text: "Авиабилеты и расстояние до Казани."}} + unrelated := epistemics.ResearchFinding{Source: epistemics.Source{Title: "Рейсы Москва — Казань", Locator: "https://example.test/moscow-kazan"}, Excerpt: epistemics.SourceExcerpt{Text: "Ближайшие к Казани города и расстояние до них."}} if researchFindingMatchesIntent(query, unrelated) { t.Fatal("one-ended travel evidence was accepted") }