Solr is highly reliable, scalable and fault tolerant,
providing distributed indexing, replication and load-balanced querying,
automated failover and recovery, centralized configuration and more. Solr
powers the search and navigation features of many of the world's largest
internet sites.
Steps :
Pre requisite
Java
Runtime Environment (JRE) version 1.7 or higher should be installed.
Command
to check : java -version
Get the Solr software
Download the latest solr zip file from
Apache-solr website.
URL to
download : http://lucene.apache.org/solr/
Extract
the zip solr file.
Start the solr
Go to solr-5.1.0\solr-5.1.0\bin
Solr
started on default8983 port.
Open
the browser : http://localhost:8983/solr/
Here examples are
used which solr has provided by default in the zip file.
Examples
exists in the directory: solr-5.1.0\solr-5.1.0\example
Create
a solr sample core in from the same "bin" directory to add the files
into core
Command
to create : solr.cmd create -c test
"test"
core created successfully
Solr provides "
post.jar" to add files on Windows which resides in the directory : " solr-5.1.0\example\exampledocs"
Add the files to solr using post.jar. Here all the xml files
are added in "exampledocs"
Go to exampledocs directory
Command
to add the xml files in test core : java -Dc=test -jar post.jar *.xml
Go to "http://localhost:8983/solr/" to check the
core "test" details
Search any of the content by value to q parameter in the
query.
For example to search a "samsung" word : http://localhost:8983/solr/test/select?q=samsung
Two "doc" are returned.
To get the document in JSON format: http://localhost:8983/solr/test/select?q=*charac*&start=0&wt=json&indent=true
Response contains two parts: responseHeader, response
ResponseHeader:
status : Always zero for successful search
QTime : Solr Search time in ms
q : query
wt : return type like json, xml
Response :
numFound : total number of records found
start : starts the result from index zero. Means first result starts from zero index. If start =2, then 0 & 1 fetched query data will be vomited
Response contains two parts: responseHeader, response
ResponseHeader:
status : Always zero for successful search
QTime : Solr Search time in ms
q : query
wt : return type like json, xml
Response :
numFound : total number of records found
start : starts the result from index zero. Means first result starts from zero index. If start =2, then 0 & 1 fetched query data will be vomited