ActiveDebianSync includes a powerful package search feature similar to
apt-file, allowing you to search for packages by name, description, or files they contain.
Search feature provides:
apt-file search)apt-file list)Enable the package search feature in your config.json:
{ "package_search_enabled": true,//Enable/disable the package search feature "sync_contents": true // Download Contents files for file-to-package search}
Note: If
sync_contentsisfalse, file search functionality will be limited as Contents files won't be available.
If you initially had sync_contents: false and later change it to true, a background scheduler will automatically:
This check runs every 15 minutes, so changes take effect without restarting the daemon.
All search endpoints are available under /api/search/ and require API access (subject to IP filtering if configured).
Endpoint: GET /api/search
Search across package names, descriptions, and files.
| Parameter | Required | Description |
q |
Yes | Search query |
type |
No | Search type: name, description, file, or empty for all |
release |
No | Filter by release (e.g., bookworm, trixie) |
component |
No | Filter by component (e.g., main, contrib) |
architecture |
No | Filter by architecture (e.g., amd64, arm64) |
exact |
No | Set to true or 1 for exact match |
limit |
No | Maximum results (default: 100) |
Example: curl "http://127.0.0.1:9090/api/search?q=nginx&type=name&release=bookworm"
Response:
{ "query": "nginx", "type": "name", "count": 15, "results": [ { "package_name": "nginx", "version": "1.22.1-9", "description": "small, powerful, scalable web/proxy server", "section": "httpd", "release": "bookworm", "component": "main", "architecture": "amd64", "filename": "pool/main/n/nginx/nginx_1.22.1-9_amd64.deb", "match_type": "name" } ]}
Endpoint: GET /api/search/file
Find packages containing a specific file path (similar to apt-file search).
| Parameter | Required | Description |
path or q |
Yes | File path to search for |
release |
No | Filter by release |
architecture |
No | Filter by architecture |
limit |
No | Maximum results (default: 100) |
Example: Find which package provides /usr/bin/vim curl : "http://127.0.0.1:9090/api/search/file?path=/usr/bin/vim"
Response:
{ "file_path": "/usr/bin/vim", "count": 2, "results": [ { "package_name": "vim", "version": "9.0.1378-2", "description": "Vi IMproved - enhanced vi editor", "release": "bookworm", "component": "main", "architecture": "amd64", "match_type": "file", "matched_file": "usr/bin/vim" } ]}
Endpoint: GET /api/search/package
| Parameter | Required | Description |
name or q |
Yes | Package name to search |
release |
No | Filter by release |
limit |
No | Maximum results (default: 100) |
Example: curl "http://127.0.0.1:9090/api/search/package?name=python3"
Endpoint: GET /api/search/description
| Parameter | Required | Description |
desc or q |
Yes | Keywords to search in descriptions |
release |
No | Filter by release |
limit |
No | Maximum results (default: 100) |
Example: Find packages related to "web server": curl "http://127.0.0.1:9090/api/search/description?q=web%20server"
apt-file list).Endpoint: GET /api/search/package-files
| Parameter | Required | Description |
package or name |
Yes | Package name |
release |
No | Filter by release |
architecture |
No | Filter by architecture |
Example: List all files in the nginx package curl "http://127.0.0.1:9090/api/search/package-files?package=nginx"
Response:
{ "package": "nginx", "count": 42, "files": [ "etc/nginx/nginx.conf", "usr/sbin/nginx", "usr/share/doc/nginx/README.Debian", "usr/share/man/man8/nginx.8.gz" ]}
Get detailed information about a specific package, including its files.
Endpoint: GET /api/search/package-info
| Parameter | Required | Description |
package or name |
Yes | Package name |
release |
No | Filter by release |
architecture |
No | Filter by architecture |
Example:curl "http://127.0.0.1:9090/api/search/package-info?package=nginx&release=bookworm"
Response:
{ "package": { "package_name": "nginx", "version": "1.22.1-9", "description": "small, powerful, scalable web/proxy server", "section": "httpd", "release": "bookworm", "component": "main", "architecture": "amd64", "filename": "pool/main/n/nginx/nginx_1.22.1-9_amd64.deb" }, "files": [ "etc/nginx/nginx.conf", "usr/sbin/nginx" ], "files_count": 42}
Get the status of the search index, including statistics and indexing progress.
Endpoint: GET /api/search/status
Example: curl "http://127.0.0.1:9090/api/search/status"
Response:
{ "enabled": true, "status": "ready", "stats": { "total_packages": 65432, "total_files": 12345678, "last_indexed": "2024-01-15T10:30:00Z" }, "index_status": [ { "release": "bookworm", "component": "main", "architecture": "amd64", "packages_count": 32000, "files_count": 6000000, "last_indexed": "2024-01-15T10:30:00Z" }, { "release": "bookworm", "component": "contrib", "architecture": "amd64", "packages_count": 1500, "files_count": 250000, "last_indexed": "2024-01-15T10:30:00Z" } ]}
curl -s "http://127.0.0.1:9090/api/search/file?path=usr/bin/convert" | jq '.results[].package_name'curl -s "http://127.0.0.1:9090/api/search?q=postgresql&limit=50" | jq '.results[] | {name: .package_name, desc: .description}'curl -s "http://127.0.0.1:9090/api/search/package-info?package=htop&release=bookworm"curl -s "http://127.0.0.1:9090/api/search/package-files?package=nginx" | jq '.files | map(select(startswith("etc/")))'curl -s "http://127.0.0.1:9090/api/search/file?path=.py&limit=20" The search feature uses an SQLite database stored alongside the configuration file (e.g., /etc/ActiveDebianSync/package_search.db).
packages:
Stores package metadata
package_name, version, description, sectionrelease, component, architecturefilename, indexed_atpackage_files:
Stores file-to-package mappings
file_path, package_namerelease, component, architectureindex_status:
Tracks indexing progress
release, component, architecturelast_indexed, packages_count, files_countsync_contents: true)sync_contents is enabledsync_contents after initial setupcurl -X POST "http://127.0.0.1:9090/api/sync/trigger"curl http://127.0.0.1:9090/api/search/statuspackages_count > 0)sync_contents: true in configdists/<release>/Contents-<arch>.gz/api/search/statuslimit parameter