Appearance
Search
Flow ID: CF-04 | Module(s): search, doofinder | Complexity: High
Business Overview
Product search supports three backends: SQL full-text (default fallback), Apache Solr (v1/v2, primary), and Doofinder (external SaaS). The system routes to the configured backend transparently. Search serves two UIs: live autocomplete dropdown (AJAX, 8 results) and full results page with pagination.
What customers experience:
- Type in search box → live autocomplete with 8 products + vendors + categories
- Submit → full results page with product grid, vendor sidebar, category links
- Results include: products, vendors, categories, product lines, blog articles (v2)
- Autocomplete suggestions and spell-check corrections (Solr v2)
Key business behaviors:
- Three backend options: SQL FULLTEXT, Solr v1/v2, Doofinder (configured via
solrSearch.enabled+solrSearch.version) - Solr field boosts:
vendor_name^10,product_name^8,category^3,description^0.001 - 80% minimum match (
mmparameter) — at least 80% of search terms must match - SOUNDEX phonetic matching for vendor names (SQL backend)
- Search terms optionally tracked in
search_tracktable - Facebook Search event + Matomo
trackSiteSearch()fired - No filtering on search results page (unlike category pages)
API Reference
Legacy Endpoints
| Method | Path | Controller | Description |
|---|---|---|---|
| GET | /search?q={term} | Adv_search.php::searchPage() | Full results page |
| GET | /search?q={term} (XHR) | Adv_search.php::liveSearch() | Autocomplete (AJAX, 8 results) |
Explicit Routes
/search → search/index
/{lang}/search → search/indexCode Flow
Search Dispatch
File: ecommercen/search/controllers/Adv_search.php
Constructor selects model version (v1/v2), optionally loads Solr client. index() routes:
- AJAX →
liveSearch()(8 products max) - Full page →
searchPage()(paginated)
Core: searchInDb() (line 337-424)
- Term preparation: trim, escape
- Search tracking: insert into
search_trackifENABLE_SEARCH_TRACK - Execute search (cached): products + vendors + categories + blog (v2) + lines
- Analytics: Facebook Conversion API (Search event), Matomo
trackSiteSearch()
SQL Backend (Solr disabled)
4 query paths UNIONed: custom (SOUNDEX vendor), codes (SKU/barcode), name (FULLTEXT), content (FULLTEXT description). Scores combined and sorted.
Solr Backend (v2)
eDisMax query with field boosts, phrase slop, 80% minimum match, spellcheck + suggest enabled. Results: extract IDs → fetch products from MySQL. Suggestions: n-gram based autocomplete from text_el_suggest field.
Domain & REST Architecture
No REST API for search — search is legacy HMVC only. Solr v2 schema uses:
- ICU tokenizer with Greek language filters
- N-gram suggestion field (min 3, max 15 grams)
- Copy fields for catch-all search
Indexing: Job AdvSolrIndex runs daily (SY-06), full re-index.
Client Extension Points
| Type | Details |
|---|---|
| Search controller | Override in application/modules/search/controllers/ |
| Search model | Override Adv_search_model*.php for custom query logic |
| Solr schema | Extend Adv_solr_model_v2 for custom fields/analyzers |
| Config | solrSearch.enabled/version/host/port in app.php |
| Boost weights | searchPartsEnabled config per search path |
| Feature flags | ENABLE_SEARCH_TRACK, FACEBOOK_CONVERSION.ENABLED |
Data Model
| Table | Purpose |
|---|---|
shop_product / shop_product_mui | Product data (FULLTEXT indexed on name/description) |
shop_vendor / shop_vendor_mui | Vendor matching |
product_codes / shop_product_barcodes | SKU/barcode matching |
search_track | Search term analytics (term, date, lang) |
Live Testing Findings
Solr Availability: The health check endpoint /_healthz/ready confirms Solr is unavailable in development environments, returning:
json
{"error": true, "message": "Search unavailable"}SQL Fallback Behavior: With Solr unavailable, the search page falls back to SQL full-text queries. The page returns HTTP 200 but yields "no results" for test queries, indicating the SQL fallback may require FULLTEXT indexes to be present and populated on the development database.
Live Search (Autocomplete): The autocomplete dropdown triggers via AJAX on each keypress in the search input. When Solr is down, live search requests complete (no server errors) but return empty result sets, providing a degraded but non-breaking experience.
Related Flows
- CF-01 Product Browsing — shares product grid component
- CF-02 Product Detail — search result links to PDP
- CF-03 URL Routing — explicit
/searchroute definition - SY-06 Solr Indexing — how products get into Solr
- IN-10 Doofinder — alternative search backend
- IN-12 Analytics — Matomo
trackSiteSearch()integration - AD-45 Search Debug — admin search debugging tools
Wiki Guide: Solr setup and schema configuration — see Solr Guide.