05 December 2016

Apache Solr 6.3.0

Solr 6.3.0 

  • Download Apache Solr from : http://www.apache.org/dyn/closer.lua/lucene/solr/6.3.0
  • Download JDK 1.8 and higher and install 

Solr Terminologies 
Source: https://wiki.apache.org/solr/SolrTerminology

Collections are made up of one or more shards. Shards have one or more replicas. Each replica is a core. A single collection represents a single logical index.

Collection:
A single search index.
SolrCloud introduces the concept of a collection, which extends the concept of a uniquely named, managed, and configured index to one that is split into shards and distributed across multiple servers

Shard:
A logical section of a single collection (also called Slice). Sometimes people will talk about "Shard" in a physical sense (a manifestation of a logical shard)

Replica:
A physical manifestation of a logical Shard, implemented as a single Lucene index on a SolrCore

Leader:
One Replica of every Shard will be designated as a Leader to coordinate indexing for that Shard

SolrCore:
Encapsulates a single physical index. One or more make up logical shards (or slices) which make up a collection. A Solr core is a uniquely named, managed, and configured index running in a Solr server; a Solr server can host one or more cores. A core is typically used to separate documents that have different schemas

Node:
A single instance of Solr. A single Solr instance can have multiple SolrCores that can be part of any number of collections.

Cluster:
All of the nodes you are using to host SolrCores.
So basically a Collection (Logical group) has multiple cores (physical indexes).


Starting Solr 


  • Set java home 

set JAVA_HOME="C:\Program Files (x86)\Java\jre1.8.0_112"

  • Stopping Solr 

$SOLR\bin\solr stop -all


  • Creating new Solr core 

start solr :
$SOLR\bin\solr start

Create core
$SOLR\bin\solr create_core -c mycore

Unload Core :
http://localhost:8983/solr/admin/cores?action=UNLOAD&deleteInstanceDir=true&core=mycore


  • Quering to Solr 

Using UI :
http://localhost:8983/solr/#/mycore/query

Using URL
http://localhost:8983/solr/mycore/select?_=1480931817687&indent=on&q=yearpub_i:1982&wt=json


  • Adding document 

From UI we can add document
http://localhost:8983/solr/#/mycore/documents

Using URL :
http://localhost:8983/solr/mycore/update?_=1480934967665&boost=1.0&commitWithin=1000&overwrite=true&wt=json

And send payload in post in following format

 <add>
  <doc>
   <field name="authors_ss">Patrick Eagar</field>
   <field name="subject_s">Sports</field>
   <field name="dd_d">796.35</field>
   <field name="numpages_i">128</field>
   <field name="desc_t"></field>
   <field name="price_d">12.40</field>
   <field name="title_t" boost="2.0"> Summer of the all-rounder: Test and 
   championship cricket in England 1982 </field>
   <field name="isbn_s">0002166313</field>
   <field name="yearpub_i">1982</field>
   <field name="publisher_ss">Collins</field>
  </doc>
 </add>


  • Delete record : 
  • From UI :
    http://localhost:8983/solr/#/mycore/documents

    Documents : <delete><query>*:*</query></delete>

    Using URL :
    http://localhost:8983/solr/mycore/update?_=1480934967665&boost=1.0&commitWithin=1000&overwrite=true&wt=json
    in Payload send the query in following format :
    <delete><query>*:*</query></delete>
    
    

    No comments:

    Post a Comment