SOLR Best Practices

Source: Internet
Author: User
Tags solr

Manage pages

Page Address: http://{ip}:{port}/solr/#/

The Data-import page of the administration page can manually rebuild the index, the configuration specifies the data source, and rebuilding the index can also be triggered by an HTTP request:
Http://{ip}:{port}/solr/{corename}/dataimport?command=full-import&clean=true&commit=true

The schema page of the Administration page is used to configure the indexed fields.

The regular full-scale rebuild index is implemented by Linux crontab every night.

Main directories and scripts under Deployment path

./: Upsolr.sh In this directory is the SOLR startup script, configured with jetty Port, jmx port, remote debug port, memory allocation, garbage collection and other startup parameters

./contexts: The Solr-jetty-context.xml file in this directory configures the SOLR app's war package information for jetty, generally without modification

./etc: Jetty.xml files in this directory can be configured with jetty parameters, jetty logs and other information, generally do not modify

./lib:jetty's Related jar package

./logs: Log file path

./resources: The log4j.properties file under this directory is a configuration file for log4j

./SOLR: This directory is the storage path for the configuration and index of each core of SOLR, and the Conf directory under the directory of the Solr.xml file configuration core and core configuration files {Corename} is the core configuration file, the data directory is the core's index file The most important two files under the Conf directory are db-data-config.xml and Schema.xml db-data-config.xml configured with data sources, Schema.xml are configured with indexed fields and field types

./SOLR-WEBAPP:SOLR the contents of the war package after decompression

Directory of the./WEBAPPS:SOLR War Package

Adding nodes
    1. Copy the files from the SOLR deployment path to the appropriate path to the new server (you can remove the log files and index files to reduce the size of the copy package when copying)

    2. Modify the relevant configuration in the upsolr.sh, if the path of the new server is inconsistent, you need to modify the log file path in the./resources/log4j.properties

    3. Start SOLR, rebuild the index, configure the Crontab timer task (if you can modify the ">/dev/null 2>&1&" section in upsolr.sh, redirect the boot output to a file, read what's wrong)

    4. Modify the corresponding configuration file in DY-SOLRJ, related project upgrade DY-SOLRJ jar Package

    5. Notify the service to change the IP of the relevant domain name agent

Add/Remove index fields

Modify the./solr/{corename}/conf/schema.xml file, if the index column name is inconsistent with the View column name, you need to configure the mapping relationship in the Db-data-config.xml file

Add Core

Modify the./solr/solr.xml file, specify the Corename and profile location, the configuration file can be copied from another core, and if you use SOLRJ you need to modify SOLRJ related code

SOLR Run

Start the server

BIN/SOLR start

This will start the server in the background, which is monitored by default on port 8983. The BIN/SOLR script allows you to customize the way you start SOLR.

See how to use the BIN/SOLR script

Bin/solr-help

You can see 10 commands to see the details of each command usage as follows. Example: View usage details for startup

BIN/SOLR Start-help
Add Document

SOLR's schema provides an approach to how content is structured, but no content is structured. SOLR needs to enter content.
Bin/post is the command used to index documents, and use-HELP to see the relevant usage information. Bin/post can post various types of content to SOLR.

Bin/post-c FY example/exampledocs/*. XML
Inquire

The index is now complete and can be queried. The simplest way is to build a URL that contains the query parameters.

    1. Example: Querying video

      http://localhost:8983/solr/fy/select?q=video

    2. Example: Querying video, but the document returns only the ID, name, and price columns

      http://localhost:8983/solr/fy/select?q=video&fl=id,name,price

    3. Example: The query has black in the Name field. If no field is specified, the default filed (set in schema) will be searched

      http://localhost:8983/solr/fy/select?q=name:black

    4. Fields can be provided. Example: Query price in 0~400

      http://localhost:8983/solr/fy/select?q=price:[0%20TO%20400]

Faceted browsing is one of the key features of SOLR. It allows users to narrow their search results. Example: E-commerce website provides facets to narrow search results by manufacturer and price.

    1. The faceted information is in the third part of the query return package. Example:

      http://localhost:8983/solr/fy/select?q=*:*&facet=true&face.field=DistrictName

    2. Facet information shows how many results each districtname has. You can use this information to make it easier to narrow your query results. You can filter the results by adding filter conditions.

      http://localhost:8983/solr/fy/select?q=*:*&facet=true&face.field=DistrictName&facet.query=普陀

SOLR Best Practices

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.