This is the sixth day of my participation in Gwen Challenge

preface

What is Solr?

Solr, developed in Java5, is a popular, fast, open source enterprise search platform built on Apache Lucene™.

Solr is highly reliable, scalable, and fault tolerant, providing distributed indexing, replication, and load balancing queries, automatic failover and recovery, centralized configuration, and more.

Solr powers the search and navigation capabilities of many of the world’s largest Internet sites.

The characteristics of the Solr

  • Advanced full-text search capabilities: Powered by Lucene ™, Solr enables powerful matching capabilities, including phrases, wildcards, joins, grouping, and any data type
  • Optimized for large volume flow:
  • Open standards-based interfaces – XML, JSON, and HTTP
  • Integrated management interface
  • Easy monitoring
  • High scalability and fault tolerance
  • Flexible adaptability and easy configuration
  • Ability to index in real time
  • Extensible plug-in architecture

Download and install Solr

1 Download (8.4.1 as an example)

www.apache.org/dyn/closer…. Based on the Solr operating environment, you need to download solR-4.10.3. TGZ in Linux or solR-4.10.3. zip in Windows.

2, decompression

  • Bin: solr running script
  • Contrib: Some contributed software/plug-ins for Solr to enhance solr’s capabilities.
  • Dist: This directory contains the WAR and JAR files generated during the build process, as well as the associated dependency files.
  • Docs: Solr API document
  • Example: Solr project directory:
  • Example /solr: This directory is a solr Core directory that contains the default configuration information.
  • Example/Multicore: This directory contains multiple Core directories set up in Solr’s multicore.
  • Example/webapps:
  • Licenses: Licenses related to Solr
  • Server: Some of solr’s services

3. Start CMD to go to the bin directory of solr

  1. Enter solr start to start the Solr service
  2. Common commands:
  3. Start command: solr start
  4. To disable the command, run solr stop-all
  5. Run the solr restart -p p_num command to restart solr
  6. The port number is 8983

4. Solr has been started

Second, configure solR core

1. Create a folder called goods

Create a new folder in F:\solr-8.4.1\server\solr. You can name the goods folder as required

2. Configuration files

Copy all files in F:\solr-8.4.1\server\solr\ configSets \sample_techproducts_configs to F:\solr-8.4.1\server\solr\ Goods

3. Select Core Admin

Enter http://localhost:8983/solr/#/ choose the Core Admin

4. Click Add Core

In name, enter the file name you just created: goods. In instanceDir, enter the file name you just created: goods. Click Add Core

5. Core is created successfully

At this point, solr builds.

Create document (table)

1. Choose core

Select the created core (Goods) -> Schema -> Add Field as follows:

2. Enter user_name and set String to Add field

Again, user_info set String and hit Add Field

3. Enter user to view the newly added field information

4. Import data

Solr supports multiple methods (database, Json, XML, CSV…) Importing data into the Solr library is flexible and convenient. The following data is imported in CSV format.

1. Select Goods -> Documents

On the right, Document Type is CSV, Documents is the data to import. The operation screenshot is as follows:

2. Click Submit Documnet to input data

Id,user_name,user_info 1, Zhang SAN, English class representative 2, Li Si, Chinese class representative 3, Millet, Math class representative 4, Wang Wu, physics class representative 5, Saturday, chemistry class representative 6, wu Move, political class representative

3. Introduction:

Status: success Response: {“responseHeader”: {” Status “: 0, “QTime”: 47}} Status Status Successful and failed Status 0 indicates the time used for successful QTime execution

Fifth, query data information and test

Select goods -> Query to Query data.

Query all data: Click Execute Query to Query all data

Status Query status 0 succeeded QTime query execution time params query data numFound amount of data queried start Paging Solr will add paging effect for each query by default when querying data using docs: start is 0 and rows is 10. That is, return the first ten records. In many cases this is sufficient, and if business requirements are not met, the specified paging parameters need to be displayed.

2. Simple query

Q: Enter the query result that matches the query field and value. For example, user_name: Zhang SAN. The query result is as follows:

Sixth, concluding remarks

Now, simple Solr is installed and simply tested. Welcome to like, pay attention to, exchange and learn from each other.