SearXNG Search Plugin for Dify
Overview
SearXNG is a free, open-source, and privacy-respecting metasearch engine that aggregates results from over 70 search services and databases. Unlike traditional search engines, SearXNG doesn't track users or build profiles, ensuring complete anonymity while delivering comprehensive search results.
This Dify plugin integrates SearXNG's powerful search capabilities directly into your Dify workflows, enabling you to:
- Perform anonymous searches across multiple engines simultaneously
- Access diverse content types (web, images, videos, news, maps, music, etc.)
- Retrieve aggregated results without compromising user privacy
- Filter results by time range and content categories
Key Features
- 🔒 Privacy-First: No tracking, profiling, or data collection
- 🌐 Multi-Engine: Aggregates results from 70+ search services
- 📊 Versatile Search Types: General, images, videos, news, maps, music, IT, science, files, and social media
- ⏰ Time Filtering: Filter results by day, week, month, or year
- 🔌 Easy Integration: Seamless integration with Dify workflows
- 🐳 Docker Support: Simple deployment using Docker containers
Table of Contents
Prerequisites
Before installing and configuring the SearXNG plugin, ensure you have:
- Dify Platform Access: Either Dify Community Edition or Dify Cloud with tool configuration permissions
- Docker Environment: Docker installed and running (for local deployment)
- Network Access: Ability to access SearXNG instance (local or remote)
- Administrative Rights: Permission to install plugins in your Dify workspace
Installation
From Dify Marketplace
- Navigate to the Dify Marketplace in your Dify dashboard
- Search for "SearXNG" in the plugins section
- Click Install to add the plugin to your workspace
- The plugin will be available in your Tools section after installation
Manual Installation
If installing manually, ensure all files are properly structured:
Configuration
Local Deployment with Docker
Step 1: Set Up SearXNG Container
Create a dedicated directory for your SearXNG instance:
Step 2: Configure SearXNG Settings
After the container starts, SearXNG will create a configuration directory. You need to modify the settings:
In the file, ensure these configurations:
Step 3: Restart and Verify
Using Existing SearXNG Instance
If you have access to an existing SearXNG deployment:
- Obtain the Base URL: Get the full URL of your SearXNG instance (e.g., )
- Verify JSON Support: Ensure the instance supports JSON format by testing:
- Check Rate Limiting: Confirm that API rate limiting allows your usage patterns
Dify Integration
- Navigate to Tools: In your Dify dashboard, go to Tools → SearXNG → To Authorize
- Enter Configuration:
- Base URL: Enter your SearXNG instance URL
- For local Docker:
- For remote instance:
- Test Connection: Click "Test" to verify connectivity
- Save Settings: Click "Save" to complete the configuration
Usage
In Dify Workflows
Once configured, you can use SearXNG in your Dify workflows:
- Add Tool Node: In your workflow, add a "Tool" node
- Select SearXNG: Choose "SearXNG Search" from the available tools
- Configure Parameters:
- Query: Enter your search terms
- Search Type: Select the type of content to search for
- Time Range: Optionally filter by time period
- Connect Output: Use the search results in subsequent workflow steps
Example Workflow Usage
Parameters
Required Parameters
| Parameter | Type | Description | Example |
|---|
| string | Search keywords or phrase | "machine learning python" |
Optional Parameters
| Parameter | Type | Default | Description | Options |
|---|
| select | "general" | Type of content to search | general, images, videos, news, map, music, it, science, files, social_media |
| select | null | Time period for results | day, week, month, year |
Search Types Explained
- General: Web pages and general content
- Images: Image files and galleries
- Videos: Video content from various platforms
- News: News articles and current events
- Map: Geographic and location-based results
- Music: Audio files and music-related content
- IT: Technology and programming resources
- Science: Scientific papers and research
- Files: Downloadable files and documents
- Social Media: Social network content
Response Format
The plugin returns search results in JSON format:
Troubleshooting
Common Issues
1. Connection Errors
Problem: "SearXNG api is required" or connection timeout
Solutions:
- Check if the SearXNG service is running:
- Verify the base URL is correct and accessible
- Ensure port 8081 is not blocked by firewall
- For Docker Desktop users, use instead of
2. JSON Format Not Supported
Problem: Results return HTML instead of JSON
Solutions:
- Verify in
- Restart the SearXNG container after configuration changes
- Test JSON endpoint directly:
3. Rate Limiting Issues
Problem: Requests are being rate-limited
Solutions:
- Set in SearXNG configuration
- Implement request throttling in your workflow
- Consider using multiple SearXNG instances for high-volume usage
4. Empty Results
Problem: "No results found" message
Solutions:
- Try different search terms or less specific queries
- Check if the selected search engines are working
- Verify the search category is appropriate for your query
- Test the same query directly on SearXNG web interface
Debugging Steps
-
Check Service Status:
-
Test API Directly:
-
Verify Configuration:
-
Network Connectivity:
Performance Optimization
For High-Volume Usage
- Resource Allocation: Increase Docker container memory and CPU limits
- Multiple Instances: Deploy multiple SearXNG instances behind a load balancer
- Caching: Implement result caching to reduce redundant searches
- Request Batching: Group similar queries when possible
Configuration Tuning
Security Considerations
- Network Security: Ensure SearXNG instance is properly secured if exposed to internet
- Rate Limiting: Implement appropriate rate limiting to prevent abuse
- Input Validation: Validate search queries to prevent injection attacks
- Access Control: Restrict access to SearXNG configuration files
- Updates: Keep SearXNG container updated with latest security patches
Contributing
We welcome contributions to improve the SearXNG plugin! Here's how you can help:
Development Setup
- Fork the Repository: Create your own fork of the plugin
- Clone Locally:
- Set Up Environment:
Making Changes
- Create Feature Branch:
- Make Your Changes: Implement your improvements
- Test Thoroughly: Verify your changes work with different SearXNG configurations
- Update Documentation: Update README and code comments as needed
- Submit Pull Request: Create a PR with detailed description of changes
Reporting Issues
When reporting issues, please include:
- Dify version and environment details
- SearXNG version and configuration
- Complete error messages and logs
- Steps to reproduce the issue
- Expected vs actual behavior
License
This plugin is released under the Apache License 2.0. See the LICENSE file for details.
Support
- Documentation: Check this README for common issues and solutions
- Community: Join the Dify community forums for discussions
- Issues: Report bugs and request features via GitHub issues
- SearXNG Documentation: Visit SearXNG docs for engine-specific information
Maintainer: Junytang
Plugin Version: 0.0.5
Dify Compatibility: Community Edition & Cloud
Last Updated: May 2025