Repository navigation
ADVANCED SEARCH
GitHub Actions Bot edited this page May 3, 2026
·
3 revisions
The nself-admin advanced search system provides full full-text search across all system data including logs, configurations, audit trails, and files. The system uses real indexing and ranking algorithms to deliver fast, accurate search results.
- Container Logs: Real-time search across Docker container logs
- Audit Logs: Search authentication and system audit trails
- Configuration Files: Search environment variables and config files (.env.*)
- Project Files: Search YAML, JSON, shell scripts, and markdown files
- Navigation: Quick access to application pages
- Result Types: Filter by log, audit, config, service, database, navigation, or file
- Services: Filter by specific Docker containers/services
- Log Levels: Filter by error, warn, info, or debug
- Date Range: Filter results by date range
- Search Options: Regex search and case-sensitive matching
Results are ranked by relevance using a scoring algorithm that considers:
- Exact title matches (highest score)
- Title prefix matches
- Title contains query
- Description matches
- Word frequency
- Recency (newer results ranked higher)
- Log level (errors boosted)
- Result type (navigation and service results boosted)
The system provides search suggestions based on:
- Frequently matched titles
- Service names
- Recent searches
- Popular queries
- Debounced search (300ms delay)
- Parallel data source searching
- Efficient result caching
- Pagination support
- Export results to JSON
src/
├── lib/
│ └── search-index.ts # Search indexing and ranking engine
├── app/
│ ├── api/
│ │ └── search/
│ │ └── route.ts # Search API endpoint
│ └── search/
│ └── page.tsx # Search page UI
└── components/
├── AdvancedSearch.tsx # Advanced search modal
└── Search.tsx # Basic navigation search
GET /api/search?q=<query>&types=<types>&services=<services>&levels=<levels>&dateFrom=<date>&dateTo=<date>®ex=<bool>&caseSensitive=<bool>&limit=<number>&offset=<number>
GET /api/search?action=suggestions&q=<query>&limit=<number>
GET /api/search?action=filters
The search index (src/lib/search-index.ts) provides:
-
search(query, options): Main search function
- Searches across all data sources in parallel
- Applies filters and ranking
- Returns paginated results
-
getSuggestions(query, limit): Get autocomplete suggestions
- Returns relevant suggestions based on partial query
- Extracts from titles and service names
-
getSearchFilters(): Get available filter options
- Returns list of active services
- Returns available result types
- Returns available log levels
Press Cmd+K (Mac) or Ctrl+K (Windows/Linux) anywhere in the app to open the advanced search modal.
Navigate to /search for the full-featured search interface with all filters visible.
import { search, getSuggestions, getSearchFilters } from '@/lib/search-index'
// Perform a search
const results = await search('error', {
types: ['log'],
services: ['postgres'],
levels: ['error'],
dateFrom: new Date('2025-01-01'),
limit: 50,
})
// Get suggestions
const suggestions = await getSuggestions('post', 5)
// Get available filters
const filters = await getSearchFilters(){
id: 'log-postgres-1234567890',
type: 'log',
title: 'postgres',
description: 'ERROR: database connection failed',
content: 'Full log message...',
timestamp: Date,
service: 'postgres',
level: 'error',
score: 75,
url: '/services/logs?container=postgres',
}{
id: 'audit-1234567890',
type: 'audit',
title: 'login_attempt',
description: 'Success - {"userId":"admin","ip":"192.168.1.1"}',
timestamp: Date,
level: 'info',
score: 45,
url: '/audit',
metadata: { /* audit log data */ },
}{
id: 'config-.env.dev-15',
type: 'config',
title: 'DATABASE_URL',
description: '.env.dev: postgres://...',
content: 'DATABASE_URL=postgres://...',
score: 60,
url: '/config/env?file=.env.dev',
metadata: { file: '.env.dev', line: 15 },
}{
id: 'file-docker-compose.yml-42',
type: 'file',
title: 'docker-compose.yml',
description: 'Match content from file...',
content: 'Full line content',
score: 40,
metadata: { file: 'docker-compose.yml', line: 42 },
}- Container logs are limited to the last 500 lines per container
- Maximum 5 containers searched simultaneously
- File searches use
grepwith optimized patterns - Results are limited to 50 by default (configurable)
- No persistent cache (real-time search)
- Debounced queries prevent excessive API calls
- Filters are cached for the session
- Use specific filters to narrow search scope
- Use date ranges for time-based queries
- Enable case-sensitive search only when needed
- Avoid very broad regex patterns
Planned improvements:
- Persistent search index with periodic updates
- Search history and saved searches
- Advanced query syntax (AND, OR, NOT operators)
- Faceted search with auto-generated filters
- Search analytics and popular queries
- Machine learning-based result ranking
- Full-text search across database content
- Search result highlighting
- Search keyboard navigation
- Saved search filters/presets
- Check if services are running (
docker ps) - Verify file permissions for config files
- Try broader search terms
- Disable case-sensitive search
- Check date range filters
- Reduce the number of active filters
- Use more specific search terms
- Limit date range
- Reduce number of services being searched
- Ensure Docker containers are running
- Check container naming in
docker ps - Verify service names match container names
Query: "connection refused"
Filters:
- Types: log
- Levels: error
- Services: postgres, redis
Query: "DATABASE_URL"
Filters:
- Types: config
Query: "failed"
Filters:
- Types: audit
- Date From: 2025-01-01
- Date To: 2025-01-31
Query: "error.*timeout"
Filters:
- Regex: enabled
- Types: log
- Search results respect system permissions
- Sensitive data in configs may appear in results
- Audit logs track all search activity
- No search query logging to prevent data leakage
- File search excludes .git and node_modules by default
Version: 1.0.0 | Updated: 2026-10-19 11:40 UTC | GitHub