Laravel Opensolr Search 1.0.0: an Open-Source Laravel 13 App on Packagist
The Laravel sample that has been linked from this site since 2019 was rebuilt from scratch: Laravel 13, Vue 3 on Vite, and exactly one search dependency, the Laravel Scout driver for Opensolr. It is MIT licensed, on GitHub and on Packagist, and it starts with a single command.
01 Start it in one command
composer create-project opensolr/laravel-opensolr-search my-search
That copies the environment file, generates the application key, creates the SQLite database and seeds twenty sample articles. The environment file already points at Opensolr's public demo account, so the search works before you have an account of your own. Two artisan commands then give your models an index and push the articles into it, and the usual npm run build and php artisan serve finish the job.
02 Two pages, two ways in
- Eloquent search — stock Laravel Scout on an
Articlemodel:Article::search($q)->where('category', $c)->paginate(). “Sleepy pets” finds the article about cats napping; the category becomes a Solr filter. - Index search — one call to
embed_and_searchover the whole index: hybrid ranking, highlighting, spelling suggestions, facet counts, a “fresh results first” toggle, and the Search Tuning saved for the index applied automatically. - Ask AI — a grounded answer written by the platform's LLM from the top hits for the question, shown next to its sources.
03 Built to be copied
Sample code gets pasted into production, so this one is written the way production code should be. Every input goes through a form request. The search endpoints are rate limited per client address, and the AI endpoint more tightly. A Content Security Policy allows scripts and styles from the application's own origin only. Solr highlights are rendered as text segments rather than HTML, and result links are validated on the server before the browser sees them. The API key never leaves the server.
04 What replaced what
Laravel 6 and Vue 2, a Solr client talking to a Solr host directly, and search results rendered straight into the page as HTML.
Laravel 13 and Vue 3, the Opensolr API through the Scout driver, server-side embeddings, hybrid relevance, a grounded AI answer, and a CI that audits every dependency on every push.
The demo account the sample ships with is public and shared, and everything created on it is deleted after three days. For an index that is yours and stays, register, the free plan is free forever, and change three lines in the environment file.