Reapply "Strengthen search breadth and modal fitting"
This reverts commit 3f824c4bdf.
This commit is contained in:
@@ -94,9 +94,9 @@ func (s *SearchService) SearchMediaWithDeadline(queries []string, enabledPlatfor
|
||||
results := make([]SearchResult, 0, 90)
|
||||
var lastErr error
|
||||
|
||||
baseQueries := limitQueries(queries, 8)
|
||||
baseQueries := limitQueries(queries, 10)
|
||||
shuffleStrings(baseQueries)
|
||||
primaryQueries := baseQueries[:minInt(len(baseQueries), 3)]
|
||||
primaryQueries := baseQueries[:minInt(len(baseQueries), 4)]
|
||||
runSearchPass := func(bases []string, onlyMissing bool) {
|
||||
for _, base := range bases {
|
||||
if !deadline.IsZero() && time.Now().After(deadline) {
|
||||
@@ -1432,9 +1432,9 @@ func limitCollectorQueries(collector string, queries []string, onlyMissing bool)
|
||||
limit := 2
|
||||
switch collector {
|
||||
case "Envato", "Artgrid":
|
||||
limit = 4
|
||||
limit = 5
|
||||
case "Google Video":
|
||||
limit = 3
|
||||
limit = 4
|
||||
}
|
||||
if onlyMissing {
|
||||
limit--
|
||||
|
||||
@@ -159,13 +159,13 @@ func TestLimitCollectorQueriesUsesSmallerBudgetForMissingPass(t *testing.T) {
|
||||
queries := []string{"a", "b", "c", "d"}
|
||||
|
||||
got := limitCollectorQueries("Artgrid", queries, true)
|
||||
if len(got) != 3 {
|
||||
t.Fatalf("expected 3 queries for missing-pass Artgrid collector, got %d", len(got))
|
||||
if len(got) != 4 {
|
||||
t.Fatalf("expected 4 queries for missing-pass Artgrid collector, got %d", len(got))
|
||||
}
|
||||
|
||||
got = limitCollectorQueries("Google Video", queries, false)
|
||||
if len(got) != 3 {
|
||||
t.Fatalf("expected 3 queries for Google Video collector, got %d", len(got))
|
||||
if len(got) != 4 {
|
||||
t.Fatalf("expected 4 queries for Google Video collector, got %d", len(got))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ func TestRemainingGeminiCapacityShrinksWithReviewedItems(t *testing.T) {
|
||||
{Link: "https://a.example"},
|
||||
{Link: "https://b.example"},
|
||||
}
|
||||
if got := RemainingGeminiCapacity(reviewed); got != 14 {
|
||||
t.Fatalf("expected 14 remaining slots, got %d", got)
|
||||
if got := RemainingGeminiCapacity(reviewed); got != 22 {
|
||||
t.Fatalf("expected 22 remaining slots, got %d", got)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ func RankSearchResults(query string, results []SearchResult) []SearchResult {
|
||||
}
|
||||
|
||||
func GeminiCandidateLimit(total int) int {
|
||||
return min(total, 16)
|
||||
return min(total, 24)
|
||||
}
|
||||
|
||||
func EvaluateAllCandidatesWithGemini(service *GeminiService, query string, ranked []SearchResult) ([]AIRecommendation, GeminiBatchStats, error) {
|
||||
@@ -291,7 +291,7 @@ func ReviewedRecommendationLinks(items []AIRecommendation) map[string]bool {
|
||||
}
|
||||
|
||||
func RemainingGeminiCapacity(reviewed []AIRecommendation) int {
|
||||
remaining := GeminiCandidateLimit(16) - len(ReviewedRecommendationLinks(reviewed))
|
||||
remaining := GeminiCandidateLimit(24) - len(ReviewedRecommendationLinks(reviewed))
|
||||
if remaining < 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ type searchCollector interface {
|
||||
type envatoCollector struct{}
|
||||
|
||||
func (envatoCollector) Name() string { return "Envato" }
|
||||
func (envatoCollector) MaxResults() int { return 12 }
|
||||
func (envatoCollector) MaxResults() int { return 16 }
|
||||
func (envatoCollector) Enabled(enabledPlatforms map[string]bool) bool {
|
||||
return len(enabledPlatforms) == 0 || enabledPlatforms["envato"]
|
||||
}
|
||||
@@ -31,7 +31,7 @@ func (envatoCollector) Enrich(searcher *SearchService, result SearchResult) Sear
|
||||
type artgridCollector struct{}
|
||||
|
||||
func (artgridCollector) Name() string { return "Artgrid" }
|
||||
func (artgridCollector) MaxResults() int { return 12 }
|
||||
func (artgridCollector) MaxResults() int { return 16 }
|
||||
func (artgridCollector) Enabled(enabledPlatforms map[string]bool) bool {
|
||||
return len(enabledPlatforms) == 0 || enabledPlatforms["artgrid"]
|
||||
}
|
||||
@@ -47,7 +47,7 @@ func (artgridCollector) Enrich(searcher *SearchService, result SearchResult) Sea
|
||||
type googleVideoCollector struct{}
|
||||
|
||||
func (googleVideoCollector) Name() string { return "Google Video" }
|
||||
func (googleVideoCollector) MaxResults() int { return 8 }
|
||||
func (googleVideoCollector) MaxResults() int { return 12 }
|
||||
func (googleVideoCollector) Enabled(enabledPlatforms map[string]bool) bool {
|
||||
return len(enabledPlatforms) == 0 || enabledPlatforms["google video"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user