feat(search): P3.1 filters and multi-query merge
Native include/exclude domains, time_range, topic, exact_match, min_score, and up to 4 queries fused with RRF. Honesty notes stay off the Warn/fail path. Tavily keeps include_answer false and sets auto_parameters false. Cache key is canonical JSON. CLI flags and skill recipe included.
This commit is contained in:
@@ -31,17 +31,20 @@ func TestTavilyOutboundAndDropsAnswer(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out := (&Tavily{Client: c, Key: "test-key"}).Search(context.Background(), "q", 5)
|
||||
out := (&Tavily{Client: c, Key: "test-key"}).Search(context.Background(), "q", 5, Filter{})
|
||||
if out.Warn != "" {
|
||||
t.Fatal(out.Warn)
|
||||
}
|
||||
var req tavilyReq
|
||||
var req map[string]any
|
||||
if err := json.Unmarshal(gotBody, &req); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if req.IncludeAnswer || req.IncludeRawContent || req.IncludeImages || req.SearchDepth != "basic" {
|
||||
if req["include_answer"] != false || req["include_raw_content"] != false || req["include_images"] != false || req["search_depth"] != "basic" {
|
||||
t.Fatalf("%+v", req)
|
||||
}
|
||||
if req["auto_parameters"] != false {
|
||||
t.Fatalf("auto_parameters %+v", req["auto_parameters"])
|
||||
}
|
||||
if strings.Contains(string(gotBody), "extract") || strings.Contains(string(gotBody), "crawl") {
|
||||
t.Fatal(string(gotBody))
|
||||
}
|
||||
@@ -70,7 +73,7 @@ func TestSearxNGMapsAndSorts(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out := (&SearxNG{Client: c}).Search(context.Background(), "q", 8)
|
||||
out := (&SearxNG{Client: c}).Search(context.Background(), "q", 8, Filter{})
|
||||
if out.Warn != "" || len(out.Hits) != 2 || out.Hits[0].Title != "a" {
|
||||
t.Fatalf("%+v", out)
|
||||
}
|
||||
@@ -88,7 +91,7 @@ func TestBraveMapsSources(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out := (&BraveLLM{Client: c, Key: "k"}).Search(context.Background(), "q", 5)
|
||||
out := (&BraveLLM{Client: c, Key: "k"}).Search(context.Background(), "q", 5, Filter{})
|
||||
if len(out.Hits) != 1 || out.Hits[0].URL != "https://s.example/x" {
|
||||
t.Fatalf("%+v", out)
|
||||
}
|
||||
@@ -110,7 +113,7 @@ func TestBraveMapsGroundingGeneric(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out := (&BraveLLM{Client: c, Key: "k"}).Search(context.Background(), "q", 5)
|
||||
out := (&BraveLLM{Client: c, Key: "k"}).Search(context.Background(), "q", 5, Filter{})
|
||||
if len(out.Hits) != 3 {
|
||||
t.Fatalf("hits %d %+v", len(out.Hits), out.Hits)
|
||||
}
|
||||
@@ -139,7 +142,7 @@ func TestTavilyBadJSONIsError(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out := (&Tavily{Client: c, Key: "k"}).Search(context.Background(), "q", 5)
|
||||
out := (&Tavily{Client: c, Key: "k"}).Search(context.Background(), "q", 5, Filter{})
|
||||
if out.Warn != "tavily: error" {
|
||||
t.Fatalf("warn %q", out.Warn)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user