GIT – If you some from the world of eCommerce, I don’t have to tell you how important role plays a good search functionality. One of the currently most popular open source eCommerce platforms, Magento, seriously lacks a good built in search engine. There is a reason for that, its not that trivial. However, some merchants simply cannot ignore this so they turn to solutions such as Solr. Solr (pronounced “solar”) is an open source enterprise search platform from the Apache Lucene  project. Full-text search, hit highlighting, faceted search, distributed search and index replication are part of Solr. This is what makes it a solid choice for integrations into eCommerce systems such as Magento. In a nutshell, Solr is an app/ run on top Jetty which is a pure Java-based HTTP (Web) and Java Servlet container.

Just for the reference:

  • Latest version of Solr at the time of this writing is 4.7.0.
  • Latest version of Java runtime (JRE) at the time of this writing is 7u45 (1.7.0_45).
  • Latest version of at the time of this writing is 6.5.

If you are a developer eager to dig into Solr, here are a few simple steps by which you can get it up and running, in lets say your virtual box powered by (lets say) CentOS.

This article assumes you have a clean of CentOS, no previous installations of Java runtimes. We start by checking the currently available Java runtimes in our CentOS repository. If you have a clean default install of CentOS minimal distribution, then you should have no Java runtime installed like shown on the screen below.

java-not-found

Next we check for the available Java runtime versions in our yum repository. We can do so with following on a console.

yum search java | grep 'java-'

You should now see a screen like the one below.

yum-grep-search-java

In this case we want to install the latest one. Following command tells the yum to install it for us.

yum install java-1.7.0-openjdk.x86_64

First you will see the confirmation screen like the one shown below (just write in the “y” and click the enter).

centos-jre-install-1

Once Java runtime is installed you should see a screen like the one below.

centos-jre-install-2

Finally, type down the java again in the console and hit enter, you should now see a console output indicating that Java runtime is there in your system like shown below.

centos-jre-install-3

Now that we have Java runtime installed, we go ahead and install wget tool, as we will use it to Solr binary. Following command will install wget into CentOS.

yum install wget

Once you confirm it and installation is done, typing wget on console and hitting enter should give us something like shown in the image below.

centos-wget-installation-2

Finally we are able to download Solr binary package. Following command will download Solr binary to the directory you are currently in within your console.

wget http://ftp.carnet.hr/misc//lucene/solr/4.6.0/solr-4.6.0.tgz

Please note that the ftp.carnet.hr is an link from mirror server from Croatia. Can easily be any other server.

Once the download is complete, you need to unpack the archive.

tar -xzf solr-4.6.0.tgz

This should dump all of the archive content into the solr-4.6.0 directory.

Solr binary archive package comes with an example application that is already set and waiting for you to run it.

cd solr-4.6.0/example/
java -jar start.jar

If you successfully followed the steps so far, you should now see a screen like the one below indicating Solr that Solr is running. You can easily stop it by pressing Ctrl + C.

solr-running

In my case, my virtual box has an address of 192.168.0.22, and Network interface set to bridget adapter, so I was able to automatically access it from my host operating system (SSH into it for example).

When Solr is running you should be able to access it through your browser at a link likehttp://192.168.0.22:8983/solr/ (just replace the IP with yours appropriately).

solr-running-in-browser

Also, within your virtual box, you might want to turn of the if you are using it only for development purposes, as it might stand in a way of accessing your Solr from browser.

Print Friendly

Comments

comments

Bài viết liên quan