Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to build Solr8 and ikanalyzer

Shulou Source: shulou.com Published: 2022-06-02 02:30:30 10月03日 Update

Today, I will talk to you about how to build Solr8 and ikanalyzer, many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.

The service is installed and started:

So far, the latest version is solr 8.1, download address: http://lucene.apache.org/solr/downloads.html

Decompress and upload to the server directory: / opt/module/solr

Cd / opt/module/solr/bin

Start the service:. / solr start stop the service:. / solr stop

Visit the page: ip:8983/solr

The dashboard on the page can view the relevant configuration:-Dsolr.solr.home=/opt/module/solr/server/solr is the home directory of the service.

Create a new core

Core Admin

Name: name at will

The InstanceDir instance directory is built in advance, for example: ${Dsolr.solr.home} / collection

The DataDir data directory, such as data, will automatically create a new directory: ${Dsolr.solr.home} / collection/data

2. Both Config and schema xml files must be placed under instanceDir. You can do the following:

a. Change to the solr home directory: at this point, there are the following directories

b. Copy the conf under the configsets directory to collection, cp configsets/sample_techproducts_configs/conf conllection/

Now you can create a new core in the page. The construction is as follows:

Configure ik-analyzer-solr Chinese word Separator

Download the latest version of ik-analyzer-solr at https://github.com/magese/ik-analyzer-solr

So far, the latest version 8.1.0 jar package and source code had better be downloaded.

Com.github.magese ik-analyzer 8.1.0

two。 The downloaded jar package is: ik-analyzer-8.1.0.jar copied to / opt/module/solr/server/solr-webapp/webapp/WEB-INF/lib. Note: solr-webapp is the same level directory as ${Dsolr.solr.home}.

3. Copy five files from resource under the source code src to / opt/module/solr/server/solr-webapp/webapp/WEB-INF/classes/. Note: the classes directory needs to be created, but it didn't exist.

IKAnalyzer.cfg.xml ② ext.dic ③ stopword.dic ④ ik.conf ⑤ dynamicdic.txt

4. Configure managed-schema for Solr and add an ik word splitter, with particular attention. The examples given in the official documentation are as follows

In particular, initialization errors and parameter errors will be reported when integrating ik-analyzer-8.1.0 and solr-8.1.1:

The correct examples are as follows

5. Finally, if you configure your own

If item_price is long, then type= "plong" instead of type= "long". Generally, you can add a p to the Java type, otherwise the error is as follows:

6. Finally, it's time to test:

After reading the above, do you have any further understanding of how to build Solr8 and ikanalyzer? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Directory service configuration content error page address copy file source code version example built two original parameter sibling name official instance Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MariaDB macOS Shulou Information Docker