solr

Application URL : http://192.168.1.208:8983/solr

User Name : administrator

Installing process.

cd ~/

wget https://downloads.apache.org/lucene/solr/8.9.0/solr-8.9.0.tgz

wget https://downloads.apache.org/lucene/solr/8.9.0/solr-8.9.0.tgz.asc

wget https://downloads.apache.org/lucene/solr/8.9.0/solr-8.9.0.tgz.sha512

install 

tar zxf solr-8.9.0.tgz

 

cd ~/solr-8.9.0/bin

sudo ./install_solr_service.sh ~/solr-8.9.0.tgz

 

 

sudo systemctl stop solr
sudo systemctl start solr 
sudo systemctl status solr 
sudo systemctl enable solr
sudo systemctl restart solr 
sudo systemctl status solr 

 

Creating the first core

su - solr -c "/opt/solr-8.9.0/bin/solr create -c testcol1 -n data_driven_schema_configs"

stop the solr 

systemctl stop solr
sudo su
sudo chmod -R 777 /var/solr/
sudo chmod -R 777 /opt/solr/

use the Core ftp to upload mysql jdbc drive to /opt/solr/dist

DATA OF CORES

All the data resides in /var/solr/data/YOURCORE/conf

go to the respective core and follow the steps

systemctl stop solr

1. Create file db-data-config.xml

<dataConfig>
    <dataSource type="JdbcDataSource"
    driver="com.mysql.jdbc.Driver"
    url="jdbc:mysql://192.168.204.100:3306/basket_prod?serverTimezone=UTC&amp;tinyInt1isBit=false"
    user="bruneiprod"
    password="5exA8IYAHeva"/>
    <document>
		<entity name="Products" pk="ItemID" query="SELECT ItemID, CategoryID, ItemName, Description, Features, Specifications, CategoryName, NetAmount, StockInHand, ImageUpdaloaded, VatIncluded, AmountIncludingVat, Discount, CompanyID, CompanyDisplayName, Flag FROM basket_prod.solr_itemload">
			<field column="ItemID" name="ItemID"/>
			<field column="CategoryID" name="CategoryID"/>
			<field column="ItemName" name="ItemName"/>
			<field column="Description" name="Description"/>
			<field column="Features" name="Features"/>
			<field column="Specifications" name="Specifications"/>
			<field column="CategoryName" name="CategoryName"/>
			<field column="NetAmount" name="NetAmount"/>
			<field column="StockInHand" name="StockInHand"/>
			<field column="ImageUpdaloaded" name="ImageUpdaloaded"/>
			<field column="VatIncluded" name="VatIncluded"/>
			<field column="AmountIncludingVat" name="AmountIncludingVat"/>
			<field column="Discount" name="Discount"/>
			<field column="CompanyID" name="CompanyID"/>
			<field column="CompanyDisplayName" name="CompanyDisplayName"/>
			<field column="Flag" name="Flag"/>
		</entity>
    </document>
</dataConfig>

Edit Managed Schema and add the fields that you want to load at the end of the file before </schema>

	<field name="ItemID" type="string" indexed="true" stored="true" multiValued="false"/>
	<field name="CategoryID" type="string" indexed="true" stored="true" multiValued="false"/>
	<field name="ItemName" type="text_general" multiValued="false"/>
	<field name="Description" type="text_general" multiValued="false"/>
	<field name="Features" type="text_general" multiValued="false"/>
	<field name="Specifications" type="text_general" multiValued="false"/>
	<field name="CategoryName" type="string" stored="true" multiValued="false"/>
	<field name="NetAmount" type="string"  stored="true" multiValued="false"/>
	<field name="StockInHand" type="string"  stored="true" multiValued="false"/>
	<field name="ImageUpdaloaded" type="string"  stored="true" multiValued="false"/>
	<field name="VatIncluded" type="string"  stored="true" multiValued="false"/>
	<field name="AmountIncludingVat" type="string"  stored="true" multiValued="false"/>
	<field name="Discount" type="string"  stored="true" multiValued="false"/>
	<field name="CompanyID" type="string" stored="true" multiValued="false"/>
	<field name="CompanyDisplayName" type="string" stored="true" multiValued="false"/>
	<field name="Flag" type="string" stored="true" multiValued="false"/>

Edit solrconfig.xml add at the bottom

	<requestHandler name="/dataimport" class="solr.DataImportHandler">
		<lst name="defaults">
			<str name="config">db-data-config.xml</str>
		</lst>
	</requestHandler>
	<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar" />
	<lib dir="${solr.install.dir:../../../..}/dist/" regex="mysql-connector-java-5.1.23-bin.jar" />
systemctl start solr