In the previous chapter, we learnt how Solr can be used in an advertising system. We understood the working of an advertising system, its architecture, and the complexities involved in the implementation of the system. We also discussed some performance improvements in Solr with respect to the advertising system. In addition, we wrote a custom plugin for Solr intended for the integration of Solr with Redis (the key value memory store).
In this chapter, we will explore an advanced package known as AJAX Solr. We will first look at the architecture of AJAX Solr and then see how different functionalities of Solr such as pagination, search result faceting, customization of search results, and tag cloud can be performed using AJAX Solr. We will cover the following topics:
AJAX is a JavaScript library that can be used to create interfaces in Apache Solr. It does not require any JavaScript framework to work, but needs an AJAX implementation to communicate with Solr. Therefore, it can be used in conjunction with JavaScript libraries and frameworks such as jQuery and Angular.js, which support AJAX. Earlier a JavaScript library called SolrJS was developed as a Solr JavaScript client. AJAX Solr is a fork of this library and has evolved as a JavaScript client for Solr.
AJAX Solr is a Solr client developed using JavaScript. AJAX Solr facilitates interesting visualizations of a result set that includes widgets to display tag clouds of facets, filtering of results by date fields, and plotting of maps based on country code information. AJAX Solr can be integrated with any web application enabling the Solr-related operations to be performed directly on the Apache Solr interface, without the necessity to incorporate any language in between.
Ideally, any request on the Internet is received by a web application residing on the server, and Solr-related operations are forwarded to the Solr server for processing. This is shown in the following diagram. The request originating from the browser travels over the Internet to the web application residing on the web server. The web server then creates a Solr request and performs the required operation on the Solr server.
With AJAX Solr, the intermediary web application can be removed from the picture, allowing the JavaScript application on the user's browser to communicate directly with Solr servers. This is shown in the following diagram. We can now add a visually appealing AJAX view of the search results without any impact on the web application.
While working with AJAX Solr, operations to be performed in Solr, such as Solr queries, are processed on the web browser using JavaScript. This reduces processing on the web application and its complexity.
The primary features of AJAX Solr are as follows: