Wiki

Clone wiki

eaccpf-ajax / Home

Faceted Search Interface to Apache Solr/Lucene Search Index

SOLR-AJAX is a single page, Javascript web application for searching and presenting data from an Apache Solr/Lucene search index. The application is easy to customize and deploy. It includes interfaces and display components for document, image, location, etc. based search.

A live demo is available at https://web.esrc.unimelb.edu.au/ECOM/.

Installation

This application requires a functioning web server and Apache Solr/Lucene search index.

Download and unzip the application package. The unzipped archive contains a number of subdirectories. Copy the contents of the app subdirectory to your web server. Open a browser and navigate to the root directory of your web server to confirm that the application is accessible.

The package includes a number of sample HTML search pages: documents.html, images.html, location.html. Each page has been configured to use a public data source as a default. Visit each page in the application and enter the search term "ballarat" in the search box; the search results on the page should update. If you experience any problems, open your browser console. You should see log entries for each search query that is executed, and information about any errors that may have occurred.

The following provides instructions and advice on how to customize your search application, and provide secure access to your Solr server to end users.

How it Works

Solr-Ajax is an Angular.js application. The application itself is made up of a collection of software components called Controllers, Filters and Services. Controllers are user interface widgets. Filters are functions used to format the display of information in the controllers. Services are components that provide common functionality that is used throughout the application, such as executing search queries and fetching results.

You can construct a customized, faceted search interface with HTML only. Configuration values for each component are specified in the HTML. Configuration options for each controller will vary, so please read the source code to determine what is appropriate.

The Angular.js tutorial is relatively short and will provide you with enough information to configure Solr-Ajax.

User Interface Components

Solr-Ajax provides the following application Controllers.

DateFacetControllerDisplay the date range of the search result set, or the entire collection. Filter search results by date range.
DateRangeHistogramControllerHistogram display of search results by year. Click a bin to filter search results by the respective year range.
DocumentSearchResultsControllerDisplays a text listing of document search results for the current query.
FacetSelectionControllerDisplay the list of facet constraints for the current query. Click a facet constraint to remove it from the query.
FieldFacetControllerDisplay a list of N facets for the current query. Click a facet to filter the current query by that value.
ImageSearchResultsControllerDisplay a grid of image search results for the current query.
MapControllerDisplay a Google Map with geolocated document search results for the current query.
SearchBoxControllerEnables the user to enter and submit a search query. Provides a drop down search hints box (typeahead, autocorrect). Constructs a Solr query and updates the browser location.
SearchHistoryControllerDisplay a list of previous search queries, with links to each query.

For example, the "data-source" attribute tells each interface component the URL for you Solr core. Set the "data-source" attribute to the URL to your Solr core.

ex. data-source="http://example.com:8080/path/to/my/solr/core"

The URL to your Solr core must be resolveable and accessible by the browser. If you are running the application as a public service, then the URL to your Solr core must be publicly accessible.

Securing Your Solr Installation

Solr-Ajax expects to communicate directly with your Apache Solr server. If you are using Solr-Ajax on a pubic web site or in an untrusted environment, such as the Internet, then you need to take additional steps to prevent attacks or misuse of your Solr server.

One approach to protect your Solr server is to install a proxy between Solr and the untrusted network environment. The job of the proxy server is to filter all incoming requests to Solr, and ensure that requests are legitimate in their construction and have been directed to the search handlers that you have specified.

A number of free, open source applications are available to accomplish this job, including the Apache web server, Nginx, and HA Proxy. As the Apache web server is widely deployed, we'll use that as an example for demonstration.

  example Apache VHOST configuration

See Solr Wiki for detailed information on securing Apache Solr.

Updated