Short tutorial on Solr Apache and How-To

Solr_search_ui

Solr_search_ui

By Going through this article you will be get answers for some questions like:

*. What is Solr

*. What are the Role of Solr for website Performance/ Why Solr is important for better website performance

*.What are the important Feature that make it worth full

*. General Configuration Settings for Solr

*. How to start Solr Server

*. Solr is a Cache Storage Engine provided by Apache Lucen.

What is Solr

Solr is one of the the popular,  fast open source enterprise search platform from the Apache Lucene. Which is basically a Cache Storage Engine with open source community support . That helps to improve website performance support.

 

 

 

What are the Role of Solr for website Performance?

 Why Solr is important for Bettter website performance?

Site Search is one of the Major section of are from where maximum customer comes and easily find out the intended result is available on that website or not. Since this is the concrete way to figure out if site has required thing available or not so Site search is mostly used by most of the visitor/customer.

 

Without Solr if someone does site search then complete database overlooked to find out the required  result. And if there are thousands of customer are searching at a time then it might be a cause of performance degradation .

Why Solr help in this scenario: Solr Cache all search result and for similar search query it directly don’t call apache or other web server but itself it provides the search result. Which improve site search performance to next level.

What are the important Feature that make it worth full

*. Distributed Cache Memory: With Solr basically we can store the data on multiple servers as well. (An example of distributed cache memory implementation with Solr if our website is hosted on one server whose IP address is 192.168.1.1 and you might have thousands and thousands records for your website during site search in that case your website performance might get worst as for each and every search item your whole database will be overlooked. Suppose their are thousands of visitors are searching same thing on your website then for each and every visitor your whole database will be overlooked that will lead to huge performance degradation . To avoid such  scenario we need to cache the search result . So that for same keyword your whole database shouldn’t be searched instead the search result would be stored in the cache and as soon as someone will search specific keyword then if its already found in cache storage then our database will be untouched for same and this way we can avoid the performance degradation through  website search.)

You can host site on one server and your search cache can be stored on another server like 192.168.2.2 so it give us the flexibility to start cache in distributed environment your web server will receive search result directly from another server.

*. Index based data storage:

Solr Server always stores data in terms for Key value pair. It matches the key if keys are already available then data into Solr wouldn’t get updated this way Solr only .

*. Open Source Support: Apache Solr Sotware is freely available for almost all platforms as its based on open source software support like Java.

*. Faceted Search: Faceted Search: Faceted Search search the document that match with search query and also generate the count for various properties or categories. It also provides the links to refine the search result.

We have various ways to refine search results based on the search queries like below are some example of facet based search using Solr

===>     &q=*:*&facet=true&facet.field=cat

===>     &q=*:*&facet=true&facet.field=cat&facet.field=inStock

====>    &q=ipod&facet=true&facet.query=price:[0 TO 100]&facet.query=price:[100 TO *]

====>    q=*:*&facet=true&facet.range=manufacturedate_dt&facet.range.start=2004-01-01T00:00:00Z&facet.range.end=2010-01-01T00:00:00Z&facet.range.gap=+1YEAR

This way we can pass our query string based on which we will get proper data as per our requirement.

*.Search UI: Solr also provide and standard UI based environment where you can search the data/documents based on query string. It can be accessed by calling the required port where Solr is installed like http://localhost:8983/solr/collection1/browse  (here 8983 port where Solr is working and configured)

Search_ui.png

*.Customized indexing of data: By configuration of Schema file we can configure easily what value of our database should be indexed on solr server . This way we can index only required indexed to be cached which will again make your search faster.

*.

General Configuration Settings for Solr:

 To Change the default port of Solr Server we need to change into Jetty.xml file.

Default path of Jetty.xml for Solr file are

–DOCUMENT_ROOT_SOLR–\example\etc\jetty.xml (Path depends on server to server)

For import the data from your database to solr server:- We need to make necessary changes on data-config.xml

–DOCUMENT_ROOT_SOLR–\example\solr\conf\data-config.xml (Path depends on server to server)

Design the data structure with Solr Server:- Schema.xml file is responsisble for  data structure and data type that gets stored on the server.

-DOCUMENT_ROOT_SOLR–\example\solr\conf\schema.xml

How to start Solr Server

 To Run Solr you should have Java installed on your server as well . If you are all set then go to command line and type below Linux command to start your Solr Server

Linux command to run Solr Server:  java -jar start.jar

 

The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video Conferencing and social media domain. The motive of creating cutehits was just to share the knowledge/solutions I get to know during my day to day life so that if possible I can help someone for same problems/solutions. CuteHits.com is a really a very effort for sharing knowledge to rest of the world. For any query/suggestion about same you can contact me on below details:- Email: shekharmca2005 at gmail.com Phone: +91-9560201363

Latest posts by Chandra Shekhar (see all)

You may also like...