mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-03 20:02:57 -05:00
[PR #9837] [MERGED] feat Make Google PSE search return more than 10 google search results #61281
Reference in New Issue
Block a user
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/9837
Author: @silverriver
Created: 2/12/2025
Status: ✅ Merged
Merged: 2/12/2025
Merged by: @tjbck
Base:
dev← Head:patch-1📝 Commits (1)
7e08373Update google_pse.py to return results more than 10📊 Changes
1 file changed (+32 additions, -16 deletions)
View changed files
📝
backend/open_webui/retrieval/web/google_pse.py(+32 -16)📄 Description
Pull Request Checklist
The Google PSE search returns maximum 10 results through 1 query. The Google PSE api returns an error if num is set to a number larger than 10. We need to use the start parameter to send multiple queries to get more than 10 results from google PSE
discussion
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Added
count > 10:countis greater than 10, the function now automatically makes multiple API calls using thestartparameter to retrieve results in pages of 10.Changed
countParameter Behavior:countparameter for values greater than 10.countis reached or no more results are available from Google PSE.countcan now exceed 10 and up to a practical maximum of 100, due to Google PSE limitations.Internal
start_indexvariable:start_indexvariable to manage thestartparameter for Google PSE API calls during pagination.start_indexis incremented by 10 in each iteration to fetch the next page of results.while count > 0loop to handle pagination logic.countis fulfilled or Google PSE returns no more results.all_resultslist before filtering and returning.if results:to break the pagination loop when Google PSE returns an empty list of results, indicating no more pages are available.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.