Appearance
Search Debug Admin
Flow ID: AD-45 | Module(s): search | Complexity: Low Last Updated: 2026-04-04
Business Context
The search debug tool provides Advisable-level administrators with a diagnostic interface for testing and analyzing Solr search queries. It allows entering a search term and viewing the raw search results, relevance scores, and debug output from the Solr engine.
The tool supports both Solr v1 and v2 search implementations, rendering version-specific debug views. It is only accessible when the APP_SOLR_DEBUG environment variable is enabled, making it a development/troubleshooting tool rather than a production feature.
API Reference
REST Endpoints
No REST API.
Legacy Admin Routes
| Route | Controller | Method | HTTP | Description |
|---|---|---|---|---|
admin/search_debug | Adv_search_debug | index | GET | Debug page (empty search) |
admin/search_debug/{searchTerm} | Adv_search_debug | index | GET | Debug page with pre-filled search term |
Code Flow
Solr v1 Debug
- Admin navigates to
admin/search_debug/{searchTerm}. index()checksisDebug()-- returns 404 ifAPP_SOLR_DEBUGis nottrue.- Loads
search_modelandsolr_modelfor v1. - Calls
search_model::searchProducts($searchTerm)which returns{ results, numRows, debug }. - Renders
search/search_debugview withsearchResults,numRows, andsearchDebugdata.
Solr v2 Debug
- Same entry point, but when
solrSearch.versionisv2. - Loads
search_model_v2andsolr_model_v2. - Runs two separate searches:
search_model_v2::searchProducts($searchTerm)-- returns products with debug data including adebug_urlto the raw Solr query.search_model_v2::searchBlogArticles($searchTerm)-- returns blog article matches with separate debug data.
- Assembles
debugResultscontaining bothproductsandblogArticlessections, each withsearchResults,numRows,searchDebug, anddebugUrl. - Renders
search/search_debug_v2view.
Domain Layer
No modern domain layer. Search debug is a pure legacy admin tool.
Architecture
| Component | Path | Purpose |
|---|---|---|
Adv_search_debug | ecommercen/search/controllers/Adv_search_debug.php | Admin controller (86 lines) |
Search_model / Search_model_v2 | ecommercen/search/models/ | Search query builders |
Solr_model / Solr_model_v2 | ecommercen/search/models/ | Solr HTTP client and response parsers |
| Routes | application/config/routes.php:724-727 | Route definitions |
Data Model
No dedicated tables. Reads from Solr search indexes.
Configuration
| Source | Key | Description |
|---|---|---|
| Environment | APP_SOLR_DEBUG | Must be true to enable the debug page |
| Config | solrSearch.version | Determines which search version (v1/v2) to use |
| Config | application/config/solr.php | Solr connection settings (host, port, core) |
Required roles: AUTH_ROLE_ADVISABLE only.
Double gate: Access requires both AUTH_ROLE_ADVISABLE role AND APP_SOLR_DEBUG=true environment variable.
Client Extension Points
- Override controller: Extend in
application/modules/search/controllers/to add custom debug panels or export features. - Override models: Extend search models to include additional debug output or custom query parameters.
Business Rules
- Environment gate: The
isDebug()method checksenv('APP_SOLR_DEBUG') === true. If false, returns 404 even for Advisable users. - Advisable-only: Only
AUTH_ROLE_ADVISABLEusers can access the debug tool. - Version-aware: Automatically uses the correct search model and view template based on the configured Solr version.
- Blog articles (v2 only): The v2 debug tool also tests blog article search, not just products.
- Debug URL: In v2, a direct Solr debug URL is provided so developers can inspect the raw Solr query and scoring in the Solr admin UI.
Related Flows
- SY-06 Solr Indexing -- Builds and maintains the Solr indexes that this tool queries
- CF-04 Search -- Storefront search that uses the same Solr infrastructure
Wiki Guide: Solr Setup Guide -- full Solr installation, configuration, and schema management guide