Solr Core Kurulum

/opt/solr-8.11.1/example/exampledocs dizinin de calistir

Datayi sql vesaire verileri iceri aktarma examples klasoru altinda mevcut post.jar

java -jar -Dbasicauth=solr:SolrRocks -Dc=tech_products post.jar *.xml

q: parametlere gore arama yapmamizi saglar ayrica df parametresinde belirtirelin etiketin icinde arama yapmamizi saglar,

fq: ters arama yapar ornegin q parametresin de ki sonucun stock u olanlar gelsin gibi.

sort : buyukten kucuge yada tersi listeleme saglar.

fl: sonucda sadece istedigimiz parametreleri gostermemizi saglar.

df: ornegin description icinde arama yapmak istiyor isek belirtir ve q: parametresine aranacak kelimeyi ekleriz.

curl -X GET –user solr:SolrRocks ‘http://localhost:8983/solr/admin/cores?action=CREATE&name=search_twitter&instanceDir=configsets/search_twitter’

Core silmek icin

curl -X GET -H "Content-Type: application/json" "http://localhost:8983/solr/admin/cores?wt=json&action=UNLOAD&core=new_core"

Crate core

instanceDir parametresine ekle

/opt/solr-8.5.0/server/solr/configsets/sample_techproducts_configs

dataimport kurulumu

Olusturulan core un dizininde var/solr/data/coreadi/conf/solrconfig.xml dosyasini ac ve ekle

<requestHandler name="/dataimport" class="solr.DataImportHandler">
	<lst name="defaults">
		<str name="config">db-data-config.xml</str>
	</lst>
</requestHandler>

<lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-cell-\d.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/contrib/langid/lib/" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-ltr-\d.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/contrib/velocity/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-velocity-\d.*\.jar" />

mysql-connector u asagidaki dizine eklemeliyiz.

opt/solr/contrib/extraction/lib/mysql-connector-java-8.0.29.jar

var/solr/data/coreadi/conf/ dizininde db-data-config.xml dosyasi olustur ve ekle

<?xml version="1.0" encoding="UTF-8"?>
<dataConfig>
    <dataSource type="JdbcDataSource"
                  driver="com.mysql.jdbc.Driver"
                  url="jdbc:mysql://localhost:3306/bilogco_opencart"
                  user="bilogco_opencart"
                  password="ser123hat"/>
 
    <document>
	  <entity name="product"  
		pk="id"
		query="select id,name from products"
		deltaImportQuery="SELECT id,name from products"
		deltaQuery="SELECT id FROM products"
		>
     <field column="id" name="id"/>
     <field column="name" name="name"/>       
  </entity>
</document>
</dataConfig>

query temizleme

solr panelde document sekmesine asagidaki kodlari gir.

xml

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

json

{'delete': {'query': '*:*'}}

yada shh da

curl http://localhost:8080/solr/update -H "Content-type: text/xml" --data-binary '*:*'
curl http://localhost:8080/solr/update -H "Content-type: text/xml" --data-binary ''

Belirli bir koleksiyonu yani query i silmek icin

http://localhost:8983/solr/admin/collections?action=DELETE&name=newCollection

https://solr.apache.org/guide/6_6/collections-api.html#CollectionsAPI-Input.6

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir