This commit is contained in:
@@ -50,6 +50,20 @@
|
|||||||
- Improved result rendering:
|
- Improved result rendering:
|
||||||
- search cards now show source snippet/description separately from AI reason to reduce confusion between asset metadata and Gemini commentary
|
- 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
|
## Local Self-Test Workflow
|
||||||
- Primary command:
|
- Primary command:
|
||||||
- `bash scripts/selftest.sh`
|
- `bash scripts/selftest.sh`
|
||||||
|
|||||||
+40
-29
@@ -92,47 +92,58 @@ func (s *SearchService) SearchMedia(queries []string, enabledPlatforms map[strin
|
|||||||
results := make([]SearchResult, 0, 90)
|
results := make([]SearchResult, 0, 90)
|
||||||
var lastErr error
|
var lastErr error
|
||||||
|
|
||||||
baseQueries := limitQueries(queries, 3)
|
baseQueries := limitQueries(queries, 6)
|
||||||
for _, base := range baseQueries {
|
primaryQueries := baseQueries[:minInt(len(baseQueries), 3)]
|
||||||
base = strings.TrimSpace(base)
|
runSearchPass := func(bases []string, onlyMissing bool) {
|
||||||
if base == "" {
|
for _, base := range bases {
|
||||||
continue
|
base = strings.TrimSpace(base)
|
||||||
}
|
if base == "" {
|
||||||
for _, source := range sources {
|
|
||||||
if len(enabledPlatforms) > 0 && !enabledPlatforms[strings.ToLower(source.name)] {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if sourceCounts[source.name] >= source.maxResults {
|
for _, source := range sources {
|
||||||
continue
|
if len(enabledPlatforms) > 0 && !enabledPlatforms[strings.ToLower(source.name)] {
|
||||||
}
|
|
||||||
for _, searchQuery := range source.build(base) {
|
|
||||||
if sourceCounts[source.name] >= source.maxResults {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
items, err := s.search(searchQuery, source.categories, source.engine, source.name)
|
|
||||||
if err != nil {
|
|
||||||
lastErr = err
|
|
||||||
items, err = s.search(searchQuery, source.categories, "", source.name)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
lastErr = err
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, item := range items {
|
if sourceCounts[source.name] >= source.maxResults {
|
||||||
if item.Link == "" || seen[item.Link] || !source.accept(item) {
|
continue
|
||||||
continue
|
}
|
||||||
}
|
if onlyMissing && sourceCounts[source.name] > 0 {
|
||||||
seen[item.Link] = true
|
continue
|
||||||
results = append(results, item)
|
}
|
||||||
sourceCounts[source.name]++
|
for _, searchQuery := range source.build(base) {
|
||||||
if sourceCounts[source.name] >= source.maxResults {
|
if sourceCounts[source.name] >= source.maxResults {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
items, err := s.search(searchQuery, source.categories, source.engine, source.name)
|
||||||
|
if err != nil {
|
||||||
|
lastErr = err
|
||||||
|
items, err = s.search(searchQuery, source.categories, "", source.name)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
lastErr = err
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, item := range items {
|
||||||
|
if item.Link == "" || seen[item.Link] || !source.accept(item) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
seen[item.Link] = true
|
||||||
|
results = append(results, item)
|
||||||
|
sourceCounts[source.name]++
|
||||||
|
if sourceCounts[source.name] >= source.maxResults {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runSearchPass(primaryQueries, false)
|
||||||
|
if len(baseQueries) > len(primaryQueries) {
|
||||||
|
runSearchPass(baseQueries[len(primaryQueries):], true)
|
||||||
|
}
|
||||||
|
|
||||||
if len(results) == 0 && lastErr != nil {
|
if len(results) == 0 && lastErr != nil {
|
||||||
return nil, lastErr
|
return nil, lastErr
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user