Library / SDK
projectblacklight/blacklight avatar
projectblacklight/blacklight

Blacklight turns a Solr index into a search interface in two commands

Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr) index.

798 stars255 forksRubyNOASSERTION

At a glance

What is it?
Blacklight is a Ruby on Rails engine that provides a discovery interface over any Apache Solr index, with a configurable search and browse front end for library and archive collections. It is Apache-2.0 licensed, needs Ruby 3.2 and Rails 7.2, maintains four release lines, and ships its front end as a separate npm package that has to be published in step with the gem.
Who is it for?
Blacklight fits a library, archive or museum that already has collections in Solr and needs a search interface that looks like a library rather than like a search box, since the engine supplies the catalogue patterns the project documented the need for. It is the wrong choice for a site with a handful of items, and the wrong choice if you cannot run Solr, since the search engine is not optional.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly Ruby, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.

Editorial analysis

A discovery layer, not a search widget

Blacklight provides a discovery interface for any Solr index, and the README describes it as an open source Solr user interface discovery platform that lets you enable searching and browsing of your collections.

The word discovery is the one to notice. A search widget answers a query. A discovery interface is the whole thing a reader sees when they arrive at a collection: a search box, a set of facets to narrow the results, a way to page through them, and a way to get to a record. Blacklight is the layer that sits between a Solr index and that interface, and the repository description calls it a rails engine, which is the key architectural fact.

Because it is an engine rather than a standalone application, it lives inside a host Rails application rather than beside it. The host decides the routes, the authentication, the look, and the deployment, and Blacklight supplies the search and browse behaviour, the configuration and the views.

Underneath, it uses Apache Solr to search full text and metadata, and the front end is described as a highly configurable Ruby on Rails front-end. The project was originally developed at the University of Virginia Library, and the front end is a separately published npm package called blacklight-frontend, which is the detail that shapes the whole release process.

Two commands to a working search page

The installation section is short, which is one of the reasons this project is still in use after more than a decade.

The engine goes into the Gemfile.

ruby
bundle add blacklight

Then the install generator runs, and the README says it copies over some initial templates, migrations, routes and configuration.

bash
bin/rails generate blacklight:install

That second command is doing the interesting work. The migrations are the database schema for the application tables Blacklight needs, the routes are the search and browse endpoints, the configuration is the Solr connection and the index settings, and the templates are the view layer you then customise. Running it inside an existing Rails application is the intended path, which is why the dependency line starts with a Gemfile rather than a download.

The README also points at the Solr configuration page in the wiki, because the project documents how it expects Apache Solr to run, and that is the part people get wrong. A Blacklight application is not self-contained, because the search engine holds the index and the engine expects a particular Solr setup, and a mismatch shows up as a page that renders with no results rather than as an error.

Four release lines, and a main branch that is not the stable one

The branch list at the top of the README is the first thing to read, and it saves an upgrade that breaks.

The main branch is where new development happens for the upcoming 9.0 release. The 8.x series lives on the release-8.x branch, the 7.x series on release-7.x and the 6.x series on release-6.x. Each of those is a maintained line rather than a historical branch, because the release history shows two different lines being published on the same day, with v9.2.1 and v7.43.0 both on 2026-09-22, and v9.2.0 a few days earlier on 2026-09-18.

That pattern is what a library with a long tail of host applications looks like. A university that upgraded its Rails application three years ago still needs a Blacklight release that works with that stack, and the 7.x line is what serves them.

So the practical advice is to choose the line that matches your host application before you add the gem, and to read the compatibility notes for that line rather than for the newest one. The README's dependency requirements are given in terms of the current versions, Ruby 3.2 and Rails 7.2 and up, and the project says it aims to support the currently supported versions of Ruby and Rails and to keep its test configuration up to date with them.

The front end is a second package that must ship in step

The release process section describes something that surprises people the first time they hit it.

You always need to release both the rubygem and the npm package simultaneously, and the summary of the technical steps is short. Make sure the package.json and VERSION files have correct and matching versions, release the ruby gem with bundle exec rake release, then build the derivative products included in the release with bundle exec rake build:npm, and publish with npm publish.

The reason is the derivative files. The javascript includes some derivative combination files that are built at release time and used by some javascript pipelines. They are placed at app/assets/javascripts/blacklight, and the README says files there should not be edited by hand.

For a contributor, the build step is similar. Install npm, then run bundle exec rake build:npm, which just runs npm install to download dependencies and npm run prepare to build the bundle. The package.json confirms the shape, with a prepare script that runs rollup twice, once for the commonjs build and once with ESM=true for the module build, and a build script that compiles the Sass with a load path into node_modules.

So a change to a javascript component in the gem is not shipped until the derivative files are rebuilt, and the two packages have to be published together. That is a maintenance cost, and it is the price of the front end being usable outside Rails.

Docker Compose brings up the app and a Solr with a precreated core

The repository ships a compose.yaml, and it is a good illustration of what Blacklight expects from Solr.

There are two services. The app service builds from the Dockerfile in the .docker/app directory, mounts the working directory into the container, waits for Solr, and publishes port 3000. Its environment carries SOLR_URL, RAILS_VERSION and VIEW_COMPONENT_VERSION, all of which the README says are set via environment variable or taken from the .env file, along with SOLR_ENV and a long ENGINE_CART_RAILS_OPTIONS list of skips for a faster boot.

The Solr service is more interesting. It sets SOLR_PORT, SOLR_VERSION and SOLR_MODULES to analysis-extras, and the image is the official Solr image with the version substituted. The configuration directory is mounted from the generator template at lib/generators/blacklight/templates/solr/conf, and the entrypoint is a list rather than a single command: docker-entrypoint.sh, solr-precreate, blacklight-core, the config path, and the JVM heap settings of 256 megabytes minimum and 512 megabytes maximum.

That entrypoint list is the mechanism, and it is worth understanding rather than copying. The container precreates a Solr core named blacklight-core before Solr starts serving, using the configuration the generator provides, so the index exists and is configured the way Blacklight expects on first run. A developer who skips that step gets a Solr with no core, and a Blacklight application that searches nothing.

Licence, browser support and the shape of the dependency

A few facts that are easy to check and worth checking.

The README says the project is made public under an Apache 2.0 licence, and the frontend package.json declares the same licence. GitHub's own classification of the repository licence is recorded as a custom one that it cannot categorise, so the LICENSE file in the tree is the text that governs, and it is worth reading rather than assuming.

Browser support is stated as a policy rather than a hope. Blacklight assumes a modern browser with support for Baseline 2023, which means Internet Explorer is explicitly not supported, and the frontend package.json encodes the same thing in its browserslist as defaults and not IE 11.

The dependency list is short and tells you what the engine is. Bootstrap is the only runtime dependency of the frontend package, with sass, rollup and prettier as development tools, and the rollup plugin for include paths. There is no JavaScript framework in there, which is a deliberate choice for a library that has to work inside somebody else's Rails application and inside a lot of institutional environments with strict content security policies.

The Ruby side is a Rails engine with a gemspec at the root, a Rakefile, a RSpec suite with .rspec and spec/, RuboCop with a todo file, a .solr_wrapper.yml for running Solr locally during development, and a template.demo.rb, which is a ready made application configuration for trying the thing out.

Where Blacklight is the wrong choice

Three situations rule it out.

The first is a site with a small collection and no Solr. Blacklight assumes the search engine, and running Solr is a real operational commitment, with a JVM, a core to configure and a reindexing story. A small collection is better served by a database query or a static search index, and a Rails engine with Solr behind it is a lot of infrastructure for a few hundred records.

The second is a team that has already built its search interface. The value Blacklight adds is the catalogue of discovery patterns, and if you have already decided how your facets, your result list and your record pages should look, then you are paying for a front end you will replace.

The third is a project that cannot run a JVM alongside the application, or that has to deploy without a Solr instance at all. Some hosting environments make a separate search service awkward, and in that case the engine's assumptions do not fit the deployment.

For an institution with a large metadata corpus, a Solr index it already maintains, and a need to present the collection the way a library presents a catalogue, the alternative to Blacklight is building the same thing again, and the four maintained release lines are evidence that many institutions have decided not to.

Editorial conclusion

Blacklight fits a library, archive or museum that already has collections in Solr and needs a search interface that looks like a library rather than like a search box, since the engine supplies the catalogue patterns the project documented the need for. It is the wrong choice for a site with a handful of items, and the wrong choice if you cannot run Solr, since the search engine is not optional. Before you start, pick a release line deliberately, because the main branch is development for the upcoming 9.0 release while the 8.x, 7.x and 6.x lines are maintained separately, and remember that installing the gem also means the front end has to be built and released alongside it.

Frequently asked questions

How do I install Blacklight in a Rails application?

Add the engine to your Gemfile with bundle add blacklight, then run bin/rails generate blacklight:install, which copies the initial templates, migrations, routes and configuration into the application.

Which Ruby and Rails versions does Blacklight require?

Ruby 3.2 or newer and Ruby on Rails 7.2 or newer. The README says Blacklight aims to support the currently supported versions of Ruby and Rails and keeps its test configuration up to date with them.

Which Blacklight release line should I use?

The main branch is where development happens for the upcoming 9.0 release, while the 8.x, 7.x and 6.x series are maintained on their own release branches. The release history shows both v9.2.1 and v7.43.0 published on 2026-09-22, so pick the line that matches your host application rather than the newest tag.

Why does Blacklight need both a gem and an npm package?

The javascript includes derivative combination files built at release time that are placed in app/assets/javascripts/blacklight and should not be edited by hand. Releasing therefore requires publishing the rubygem and the npm package simultaneously, with matching versions in package.json and VERSION, and rebuilding the derivative files with bundle exec rake build:npm.

How does the Blacklight Docker setup configure Solr?

The compose file runs the official Solr image with SOLR_MODULES set to analysis-extras, mounts the generator's configuration directory over the Solr conf path, publishes port 8983, and uses an entrypoint that precreates a core named blacklight-core with a 256 megabyte minimum and 512 megabyte maximum heap before Solr serves requests.

Official sources

  1. Issues
  2. projectblacklight/blacklight on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/projectblacklight-blacklight.svg)](https://hysenlabs.com/projects/projectblacklight-blacklight)

Was this useful?