Add time_range filter to Research Bridge API and optimize SearXNG config for news

This commit is contained in:
Henry
2026-03-14 13:41:20 +00:00
parent 561e655a67
commit c0d6e72d7c
4 changed files with 67 additions and 6 deletions

View File

@@ -59,11 +59,12 @@ class SearXNGClient:
query_string = "&".join(query_parts)
return f"{self.base_url}/search?{query_string}"
async def search(self, request: SearchRequest) -> SearchResponse:
async def search(self, request: SearchRequest, time_range: str | None = None) -> SearchResponse:
"""Execute search query against SearXNG.
Args:
request: SearchRequest with query, engines, page
time_range: Optional time filter (day, week, month, year)
Returns:
SearchResponse with results
@@ -77,6 +78,10 @@ class SearXNGClient:
"engines": ",".join(request.engines),
"pageno": request.page,
}
# Add time_range if specified (SearXNG supports: day, week, month, year)
if time_range:
params["time_range"] = time_range
url = self._build_url(params)
client = self._get_client()