SearXNG is a privacy-focused metasearch engine that aggregates results from multiple search engines without tracking you. This guide covers both web interface usage and API access for AI agents.
Open your browser and navigate to:
https://search.haiven.local
Click the tabs to switch between categories:
| Category | Description |
|---|---|
| General | Web pages from Google, Bing, DuckDuckGo, etc. |
| Images | Image search results |
| Videos | Video content from YouTube, etc. |
| News | Recent news articles |
| IT | Technical content from GitHub, Stack Overflow |
| Files | File downloads and archives |
| Science | Academic papers from arXiv, PubMed |
| Maps | Geographic information |
| Syntax | Example | Description |
|---|---|---|
!bang |
!g python |
Search Google only |
site: |
site:github.com docker |
Limit to specific site |
"quotes" |
"exact phrase" |
Exact phrase match |
-exclude |
python -snake |
Exclude term |
Click the gear icon to customize:
- Default language
- Safe search level
- Result display options
- Theme (light/dark/auto)
- Enabled search engines
POST https://search.haiven.local/search
POST http://searxng:8080/search (internal)
| Parameter | Required | Description | Example |
|---|---|---|---|
q |
Yes | Search query | docker networking |
format |
No | Output format | json, csv, rss |
categories |
No | Categories to search | general,it |
engines |
No | Specific engines | google,github |
language |
No | Language code | en-US |
pageno |
No | Page number | 1, 2, 3 |
time_range |
No | Time filter | day, week, month, year |
safesearch |
No | Safety level | 0 (off), 1 (moderate), 2 (strict) |
curl -X POST "https://search.haiven.local/search" \
-d "q=docker best practices&format=json"
# Search news from last 24 hours
curl -X POST "https://search.haiven.local/search" \
-d "q=artificial intelligence&format=json&categories=news&time_range=day"
# Search only GitHub and Stack Overflow
curl -X POST "https://search.haiven.local/search" \
-d "q=python async await&format=json&engines=github,stackoverflow"
{
"query": "docker networking",
"number_of_results": 127,
"results": [
{
"title": "Docker Networking Overview",
"url": "https://docs.docker.com/network/",
"content": "Docker's networking subsystem is pluggable...",
"engine": "google",
"score": 1.0,
"category": "general"
}
],
"suggestions": ["docker network types", "docker bridge network"],
"answers": [],
"infoboxes": []
}
import requests
def search(query, categories="general"):
response = requests.post(
"http://searxng:8080/search",
data={
"q": query,
"format": "json",
"categories": categories
},
timeout=10
)
return response.json()
# Example usage
results = search("python web scraping")
for r in results.get("results", [])[:5]:
print(f"{r['title']}: {r['url']}")
import requests
from functools import lru_cache
@lru_cache(maxsize=100)
def cached_search(query: str, categories: str = "general"):
"""Search with caching to reduce API calls."""
try:
response = requests.post(
"http://searxng:8080/search",
data={
"q": query,
"format": "json",
"categories": categories,
"safesearch": "1"
},
timeout=15
)
response.raise_for_status()
return response.json()
except requests.RequestException as e:
return {"error": str(e), "results": []}
def web_search_tool(query: str, max_results: int = 5) -> list:
"""
Web search tool for LLM function calling.
Args:
query: Search query string
max_results: Maximum results to return
Returns:
List of search results with title, url, and snippet
"""
response = requests.post(
"http://searxng:8080/search",
data={"q": query, "format": "json"},
timeout=10
)
results = response.json().get("results", [])
return [
{
"title": r.get("title", ""),
"url": r.get("url", ""),
"snippet": r.get("content", "")[:200]
}
for r in results[:max_results]
]
# Search and format with jq
curl -s -X POST "https://search.haiven.local/search" \
-d "q=kubernetes deployment&format=json" | \
jq '.results[:3] | .[] | {title, url}'
# Get today's tech news
curl -s -X POST "https://search.haiven.local/search" \
-d "q=technology&format=json&categories=news&time_range=day" | \
jq '.results[:5] | .[] | .title'
# Get image URLs
curl -s -X POST "https://search.haiven.local/search" \
-d "q=mountain landscape&format=json&categories=images" | \
jq '.results[:5] | .[] | .img_src'
docker compose logs searxng | grep -i "error"
Try a different search category or engine
Check network connectivity:
docker exec searxng ping -c 3 google.com
docker exec searxng-redis redis-cli ping
The limiter is disabled for private instances. If you see 429 errors:
docker compose restart searxng