CoAI LogoCoAI.Dev
Features

Search Integration

Add web search capabilities to AI models with multi-engine support and intelligent result processing

Search Integration

CoAI.Dev provides powerful web search capabilities that work with all AI models, regardless of their native search abilities. This self-developed search integration uses SearXNG to access multiple search engines and provide comprehensive, up-to-date information to enhance AI responses.

Overview

The search integration system offers:

  • 🌐 Multi-Engine Support: Access to 20+ search engines including Google, Bing, DuckDuckGo
  • 🤖 Universal Compatibility: Works with all AI models, not just those with built-in search
  • 🔒 Privacy Protection: Proxy-based search with user privacy protection
  • 📊 Content Processing: Intelligent result filtering and summarization
  • ⚡ Performance Optimization: Cached results and parallel search queries
  • 🛡️ Safe Search: Content filtering and safety controls

Enhanced AI Capabilities

Web search integration transforms any AI model into a research assistant with access to real-time information from the internet.

Supported Search Engines

Primary Search Engines

Global Search Platforms

  • Google: World's largest search engine with comprehensive indexing
  • Bing: Microsoft's search engine with integration to Microsoft services
  • DuckDuckGo: Privacy-focused search without user tracking
  • Yahoo: Web search with news and content aggregation
  • Yandex: Russian search engine with strong regional content

Search Features:

  • Web page indexing and ranking
  • Real-time content crawling
  • Multiple language support
  • Advanced search operators
  • Image and video search capabilities

Configuration Options:

{
  "primary_engines": {
    "google": {"weight": 0.4, "enabled": true},
    "bing": {"weight": 0.3, "enabled": true},
    "duckduckgo": {"weight": 0.2, "enabled": true},
    "yahoo": {"weight": 0.1, "enabled": false}
  }
}

Core Features

Intelligent Search Processing

Content Analysis and Filtering:

  • Relevance Scoring: Rank results by query relevance
  • Content Summarization: Extract key information from search results
  • Duplicate Removal: Eliminate redundant information across sources
  • Quality Assessment: Filter low-quality or spam content
  • Fact Verification: Cross-reference information across multiple sources

Search Result Enhancement:

{
  "processing": {
    "max_results_per_engine": 10,
    "content_extraction": true,
    "summary_generation": true,
    "relevance_threshold": 0.7,
    "duplicate_removal": true
  }
}

Privacy and Security

User Privacy Protection:

  • Proxy Search: All searches go through proxy servers
  • No User Tracking: Search queries not linked to user accounts
  • IP Masking: Hide user IP addresses from search engines
  • Query Anonymization: Remove identifying information from searches
  • Secure Connections: HTTPS encryption for all search requests

Safe Search Configuration:

{
  "safety": {
    "safe_search": "moderate", // strict, moderate, off
    "content_filtering": true,
    "adult_content_block": true,
    "malware_protection": true,
    "phishing_detection": true
  }
}

Performance Optimization

Speed and Efficiency:

  • Parallel Queries: Search multiple engines simultaneously
  • Result Caching: Cache frequent queries for faster response
  • Load Balancing: Distribute queries across search engine instances
  • Timeout Management: Handle slow or unresponsive engines gracefully
  • Rate Limiting: Respect search engine rate limits

Performance Tuning:

{
  "performance": {
    "parallel_search": true,
    "max_concurrent_queries": 5,
    "query_timeout": 10,
    "cache_duration": 3600,
    "rate_limit_per_minute": 60
  }
}

Setup and Configuration

SearXNG Deployment

SearXNG is the powerful meta-search engine that powers CoAI.Dev's search capabilities:

Deploy SearXNG

Using Docker (Recommended):

git clone https://github.com/zmh-program/searxng.git
cd searxng
 
# Generate secret key
sed -i "s|ultrasecretkey|$(openssl rand -hex 32)|g" searxng/settings.yml
 
# Configure environment variables
cp .env.example .env
# Edit .env file with your hostname and email
 
# Start SearXNG
docker-compose up -d

Manual Installation:

# Install dependencies
apt update && apt install python3 python3-pip git
 
# Clone and setup
git clone https://github.com/searxng/searxng.git
cd searxng
pip3 install -r requirements.txt
 
# Configure settings
cp searxng/settings.yml.example searxng/settings.yml
# Edit settings.yml as needed
 
# Start service
python3 searx/webapp.py

Configure Search Engines

Edit searxng/settings.yml to enable/disable search engines:

engines:
  - name: google
    engine: google
    weight: 1
    disabled: false
    
  - name: bing
    engine: bing
    weight: 1
    disabled: false
    
  - name: duckduckgo
    engine: duckduckgo
    weight: 1
    disabled: false
    
  - name: wikipedia
    engine: wikipedia
    weight: 1
    disabled: false

Configure CoAI.Dev Integration

In CoAI.Dev admin panel, configure the search service:

  1. Navigate to System SettingsGeneral Settings
  2. Find "Search Service" configuration
  3. Enter your SearXNG URL: http://your-server-ip:7980
  4. Configure search parameters and enable the feature
  5. Test the search functionality

Configuration Example:

{
  "search_service": {
    "enabled": true,
    "endpoint": "http://your-searxng-server:7980",
    "api_key": "optional-api-key",
    "default_engines": ["google", "bing", "wikipedia"],
    "max_results": 10,
    "safe_search": "moderate"
  }
}

Test Search Functionality

Verify the search integration is working:

  1. Go to the main chat interface
  2. Click the "Web Search" button in the toolbar
  3. Send a query that requires current information
  4. Verify that search results are included in the AI response
  5. Check search logs for any errors or issues

Advanced Configuration

Engine-Specific Settings:

# searxng/settings.yml
engines:
  - name: google
    engine: google
    use_mobile_ui: false
    supported_languages: ["en", "de", "fr"]
    timeout: 3.0
    
  - name: bing
    engine: bing
    api_key: "optional-bing-api-key"
    custom_settings:
      market: "en-US"

Search Result Processing:

{
  "result_processing": {
    "extract_snippets": true,
    "follow_redirects": false,
    "extract_metadata": true,
    "image_proxy": true,
    "content_length_limit": 5000
  }
}

Usage Examples

Real-Time Information Queries

Current Events and News:

User: "What are the latest developments in AI technology this week?"

AI with Search: 
- Searches multiple news sources and tech websites
- Aggregates recent AI announcements and breakthroughs
- Provides up-to-date information with source citations
- Analyzes trends and implications

Market Data and Statistics:

User: "What's the current stock price of Tesla and recent market trends?"

AI with Search:
- Retrieves real-time stock data
- Searches for recent news affecting Tesla
- Provides market analysis and expert opinions
- Includes relevant financial metrics and comparisons

Research and Analysis

Academic Research:

User: "Find recent research on quantum computing applications in cryptography"

AI with Search:
- Searches academic databases (Arxiv, Google Scholar)
- Retrieves recent papers and publications
- Summarizes key findings and methodologies
- Provides citations and further reading suggestions

Technical Documentation:

User: "How do I implement OAuth 2.0 authentication in Node.js?"

AI with Search:
- Searches programming resources (GitHub, Stack Overflow)
- Finds official documentation and tutorials
- Provides code examples and best practices
- Includes troubleshooting tips and common issues

User Interface Integration

Search Activation

Manual Search Control:

  • Users can toggle web search on/off for each conversation
  • Search button in the chat interface toolbar
  • Visual indicators when search is active
  • Search result sources displayed in responses

Automatic Search Triggers:

{
  "auto_search": {
    "enabled": true,
    "triggers": [
      "current events keywords",
      "recent data requests",
      "specific factual queries",
      "technical documentation needs"
    ],
    "confidence_threshold": 0.8
  }
}

Result Presentation

Search Result Integration:

  • Seamless integration of search results into AI responses
  • Source citations and links for verification
  • Snippet previews of relevant content
  • Image and media content when appropriate

User Experience Features:

  • Loading indicators during search operations
  • Search progress updates for complex queries
  • Error handling for failed searches
  • Alternative suggestions when no results found

Troubleshooting

Common Issues

Search Timeouts

Problem: Search queries timeout or take too long

Solutions:

  1. Check SearXNG server performance and resources
  2. Optimize search engine selection and weights
  3. Reduce timeout values for faster responses
  4. Use regional servers closer to users
  5. Implement search result caching

Configuration Fix:

# Reduce timeout values
engines:
  - name: google
    timeout: 2.0  # Reduced from default 3.0

Limited Search Results

Problem: Search engines return limited or no results

Solutions:

  1. Verify search engine availability in your region
  2. Check for IP blocking or rate limiting
  3. Use VPN or proxy for geo-restricted engines
  4. Enable multiple search engines for redundancy
  5. Monitor search engine status pages

Regional Access:

# Use proxy for restricted engines
engines:
  - name: google
    proxies:
      http: "http://proxy-server:8080"
      https: "https://proxy-server:8080"

Performance Optimization

Search Speed Improvements:

  • Enable parallel search across engines
  • Implement intelligent result caching
  • Optimize search query preprocessing
  • Use CDN for static search resources
  • Monitor and tune timeout values

Resource Management:

  • Scale SearXNG instances for high load
  • Implement load balancing across search servers
  • Monitor memory and CPU usage
  • Optimize database queries for search logs
  • Use efficient result storage formats

Security Considerations

Privacy Protection:

  • Ensure all search traffic is encrypted
  • Implement user query anonymization
  • Regular security audits of search infrastructure
  • Compliance with privacy regulations (GDPR, CCPA)
  • Monitor for potential data leaks

Content Safety:

  • Configure appropriate safe search levels
  • Implement content filtering for inappropriate results
  • Monitor search queries for abuse patterns
  • Block malicious websites and phishing attempts
  • Regular updates to security filters

Web search integration significantly enhances the capabilities of your AI platform by providing access to real-time information. Continue with Conversation Sharing to enable collaborative features, or explore File Processing for document analysis capabilities.