Restore Envato and Artgrid fallback search breadth
build-push / docker (push) Successful in 4m31s

This commit is contained in:
AI Assistant
2026-03-13 18:44:19 +09:00
parent 7dfb1ad2de
commit 06ea4f3ecd
2 changed files with 54 additions and 29 deletions
+14
View File
@@ -50,6 +50,20 @@
- Improved result rendering:
- search cards now show source snippet/description separately from AI reason to reduce confusion between asset metadata and Gemini commentary
## Current Session Update (2026-03-13, Regression Fix)
- A regression was found after search optimization:
- Envato and Artgrid disappeared entirely for some real searches while Google Video still returned results
- Root cause:
- the first optimization reduced query-variant breadth too aggressively
- the first 3 query variants were not enough to recover Envato/Artgrid in some real SearXNG result sets
- Fix applied:
- search now runs in two stages
- stage 1 searches only the first few variants for speed
- stage 2 searches additional variants only for sources that still returned zero results
- Intent:
- keep the anti-timeout optimization
- recover Envato/Artgrid recall when the early pass is too narrow
## Local Self-Test Workflow
- Primary command:
- `bash scripts/selftest.sh`
+13 -2
View File
@@ -92,8 +92,10 @@ func (s *SearchService) SearchMedia(queries []string, enabledPlatforms map[strin
results := make([]SearchResult, 0, 90)
var lastErr error
baseQueries := limitQueries(queries, 3)
for _, base := range baseQueries {
baseQueries := limitQueries(queries, 6)
primaryQueries := baseQueries[:minInt(len(baseQueries), 3)]
runSearchPass := func(bases []string, onlyMissing bool) {
for _, base := range bases {
base = strings.TrimSpace(base)
if base == "" {
continue
@@ -105,6 +107,9 @@ func (s *SearchService) SearchMedia(queries []string, enabledPlatforms map[strin
if sourceCounts[source.name] >= source.maxResults {
continue
}
if onlyMissing && sourceCounts[source.name] > 0 {
continue
}
for _, searchQuery := range source.build(base) {
if sourceCounts[source.name] >= source.maxResults {
break
@@ -132,6 +137,12 @@ func (s *SearchService) SearchMedia(queries []string, enabledPlatforms map[strin
}
}
}
}
runSearchPass(primaryQueries, false)
if len(baseQueries) > len(primaryQueries) {
runSearchPass(baseQueries[len(primaryQueries):], true)
}
if len(results) == 0 && lastErr != nil {
return nil, lastErr