Solr – walk-through – (Part 1)

Full Resource: http://lucene.apache.org/solr/resources.html

to start solr

java -jar start.jar

alternative way to start solr

C:\solr-6.0.0\bin>solr start -p 8984

http://localhost:8983/solr/#/

 

cat field added as an extra:

 

adding text/csv into solr

querying

advanced query

solr response

 

Solr builds on another open source search technology: Lucene, a Java library that provides indexing and search technology, as well as spellchecking, hit highlighting and advanced analysis/tokenization capabilities.

The default port when running Solr is 8983. The Lucene search library currently ranks among the top 15 open source projects and is one of the top 5 Apache projects.

checking java version

Start Solr with a Specific Example Configuration

solr status

Create a Core

Solr is built to find documents that match queries. Solr’s schema provides an idea of how content is structured (more on the schema ), but without documents there is nothing to find. Solr needs input before it can do later
much.

java -Dc=SampleCore -jar post.jar C:\solr-6.0.0\example\exampledocs\*.xml

post.jar

usage:

example docs:

results:

http://localhost:8983/solr/SampleCore/select?q=video&fl=id,name,price

Faceted browsing is one of Solr’s key features. It allows users to narrow search results in ways that are meaningful to your application.

For example, a shopping site could provide facets to narrow search results by manufacturer or price.

http://localhost:8983/solr/SampleCore/select?q=price:[0%20TO%20400]&facet=true&facet.field=cat

http://localhost:8983/solr/SampleCore/select?q=price:0%20TO%20400&fl=id,name,price,cat&facet=true&facet.field=cat&fq=cat:software

Here is a example of how Solr might be integrated into an application:

Solr queries are RESTful, which means, in essence, that a query is a simple HTTP request URL and the response is a structured document: mainly XML, but it could also be JSON, CSV, or some other format.

You have so much data, or so many queries, that a single Solr server is
unable to handle your entire workload. In this case, you can scale up the capabilities of your application using So to better distribute the data, and the processing of requests, across many servers. Multiple options can SolrCloud be mixed and matched depending on the type of scalability you need.

solr home directory

C:\solr-6.0.0\server\solr\SampleCore\conf\solrconfig.xml

It is highly recommended that you fully re-index after changing this setting as it can affect both how text is indexed and queried.

index location for SampleCore

restart solr

The start and restart commands have several options to allow you to run in SolrCloud mode, use an example configuration set, start with a hostname or port that is not the default and point to a local ZooKeeper ensemble.

To emphasize how the default settings work take a moment to understand that the following commands are
equivalent:

Setting Java System Properties

The bin/solr script will pass any additional parameters that begin with -D to the JVM, which allows you to set arbitrary Java system properties. For example, to set the auto soft-commit frequency to 3 seconds, you can do:

stop all solr instances:

sample configsets

bin/solr status

solr healthcheck

In cloud mode, all the configuration is stored in ZooKeeper, and the create script does not need to make directories or copy
configuration files. Solr itself will create all the necessary directories.

default configurations

creating core with config parameters

Notice that we used the option to specify a different configuration than the default. Solr provides several -d built-in configurations under . However you can also provide the path to your own server/solr/configsets
configuration directory using the option.

The following command will create a new collection that shares the basic configuration -n created previously:

Do not share data-driven configurations between collections unless you are certain that all collections should inherit the changes made when indexing data into one of the collections.

solr logging level by classes

very simple two-node cluster created using the
bin/solr -e cloud

If you are running a single node Solr instance, you will not see a Collections option in the left nav menu of the Admin UI.

solr status after cloud created

Analysis Screen

dll missing in JDBC

Dataimport Screen

dataimport section under SampleCore

solrconfig.xml changes for required libraries

include libraries for data import and sql connection.

additional solrconfig.xml changes for requestHandler section.

db-data-config.xml changes for dataSource. In this case this is sql server.

we should include sqljdbc_auth.dll under C:\Windows\System32

click on execute again

and here is the result!

 

Leave a Reply

Your email address will not be published. Required fields are marked *