Time for action – using Bean Scripting Framework and JavaScript

At this point, it should be clear that it's simple to index data with the Java API (we simply have to call the methods .add() and .addBean() on a server instance), thereby making querying flexible, and we can use some different wrappers of a SolrServer instance that are functionally equivalent.

This is not the end of the story, however, as it's possible to use the SolrJ library's APIs in JavaScript by using the Bean Scripting Framework (BSF), which is an Apache library designed to integrate scripting languages' code into a Java application. Note that there are other languages supported by BSF, such as Groovy or Clojure, and the same approach used here with JavaScript can be adopted ...

Get Apache Solr Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.