Autocomplete
Autocomplete shows instant suggestions as visitors type in the search box. It helps them find what they're looking for faster and discover popular searches on your site.
Enabling autocomplete
Go to the Search Display tab (/admin/config/search/opensolr/display) and check the "Autocomplete" checkbox under Search Features.
How it works
As a visitor types, after a short delay (300ms), the module fetches suggestions from two sources:
🔎 Search History
The top 3 most popular previous searches that match what the visitor is typing. These come from the module's analytics data. Shown with a search icon and a count badge.
📄 Live Results
Real search results from your Solr index matching the typed text. Shown with a favicon and date. Clicking goes directly to the page.
Up to 10 suggestions are shown total — 3 from search history (max), the rest from live Solr results.
What visitors see
- Matching text is highlighted — the typed characters are bolded in each suggestion (for terms 3+ characters)
- Keyboard navigation — visitors can use arrow keys to move through suggestions and Enter to select
- Click a suggestion — runs the search with that query
- Click a result — navigates directly to that page
- Escape or click outside — closes the suggestions dropdown
Customization
The autocomplete dropdown is rendered using a Twig template that you can override from your theme:
Copy opensolr-autocomplete-item.html.twig from the module's templates/ folder into your theme's templates/ folder and customize it.
Suggestions improve over time as more visitors use your search. The more searches happen, the better the autocomplete becomes at predicting what visitors want.