Integrating Apache Solr with Play Framework in Scala

Typical IT landscape of any large size organization comprises of many different technologies. Apache Solr provides excellent ways to gather information from different types of sources, however the business may demand for integrating Apache Solr with non-J2EE based technology. Although there are various technologies available in market, the placement of Apache Solr like enterprise search engine in broader picture of organization’s IT topology is always targeted for specific areas. This area is nothing but the end user web portals. Search engines are designed to provide information to end users, and they are expected to respond as fast as they can. Since they do not provide anything else beyond search, they always go in embedded mode with the applications. These applications mainly use various web based technologies. I will look at some other web based technologies and how Apache Solr can be integrated with Scala and Play .

solr-play-scala-client is a scala library for indexing and searching documents within an Apache Solr installation for Play Framework.

Using Solr Scala Client for Play Framework.

Solr scala client library provides rich APIs for indexing and searching in remote Apache Solr. This was one of the robust and easiest implementation of APIs that can be used for integration, See Github. Solr Scala Client for Play framework is compatable with Solr 4.x.

Architecture of solr-play-scala-client

Edit the following configuration of your Apache Solr Server in application.conf.

Screen Shot 2016-06-30 at 3.39.01 PM

After installation Play Framework and clone this project, just do the following commands

Screen Shot 2016-06-30 at 3.39.08 PM

Now you can check localhost to make sure that everything is fine.
This example allow you to use get api for Apache Solr
http://localhost:9000/get?query=kia

Query Syntax

Screen Shot 2016-06-30 at 3.38.14 PM

Indexing

Screen Shot 2016-06-30 at 3.38.23 PM

Returning Results

Screen Shot 2016-06-30 at 3.38.30 PM

Faceted Search
Screen Shot 2016-06-30 at 3.38.37 PM

Leave a Reply

Your email address will not be published.