RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix(agent): exclude patents, not citations, when GoogleScholar patents is false (#20261)
Eugene Kalinin6aff0d49d0a0
diff --git a/internal/agent/tool/google_scholar.go b/internal/agent/tool/google_scholar.goindex 462e0e99fc..8cc1698fb6 100644--- a/internal/agent/tool/google_scholar.go+++ b/internal/agent/tool/google_scholar.go@@ -177,8 +177,10 @@ func buildGoogleScholarURL(query string, maxResults int, sortBy string, yearLow,if yearHigh > 0 {q.Set("as_yhi", strconv.Itoa(yearHigh))}+ // as_sdt is Scholar's patents switch (as_vis toggles citations), matching+ // scholarly's _construct_url: as_sdt={1-patents},33.if patents != nil && !*patents {- q.Set("as_vis", "1")+ q.Set("as_sdt", "1,33")}return googleScholarEndpoint + "?" + q.Encode()diff --git a/internal/agent/tool/google_scholar_test.go b/internal/agent/tool/google_scholar_test.goindex 332757f616..dffdf7c5c0 100644--- a/internal/agent/tool/google_scholar_test.go+++ b/internal/agent/tool/google_scholar_test.go@@ -117,7 +117,7 @@ func TestGoogleScholar_BuildURL(t *testing.T) {wantNum: "5",wantHost: "scholar.google.com",wantQuery: "ai",- wantParams: map[string]string{"as_vis": "1"},+ wantParams: map[string]string{"as_sdt": "1,33", "as_vis": ""},},{name: "include patents (default)",@@ -143,7 +143,8 @@ func TestGoogleScholar_BuildURL(t *testing.T) {"scisbd": "1","as_ylo": "2019","as_yhi": "2023",- "as_vis": "1",+ "as_sdt": "1,33",+ "as_vis": "",},},}@@ -347,8 +348,11 @@ func TestGoogleScholar_MergesNodeLevelDefaults(t *testing.T) {if q.Get("as_yhi") != "2024" {t.Errorf("as_yhi = %q, want 2024", q.Get("as_yhi"))}- if q.Get("as_vis") != "1" {- t.Errorf("as_vis = %q, want 1", q.Get("as_vis"))+ if q.Get("as_sdt") != "1,33" {+ t.Errorf("as_sdt = %q, want 1,33", q.Get("as_sdt"))+ }+ if q.Has("as_vis") {+ t.Errorf("as_vis = %q, want unset", q.Get("as_vis"))}w.Header().Set("Content-Type", "text/html; charset=UTF-8")_, _ = w.Write([]byte(cannedScholarHTML))