Chapter 3, Solr's Small Trial - Create a Simple Core and Use It to Search

The solr environment has been set up before, and now we can create a Core and use it to search for what we need

1. Create a new core directory

In the "solr/home" directory configured earlier, create a new core directory core_test

 

2. Configure core

Copy the directory solr-6.1.0\server\solr\configsets\data_driven_schema_configs\conf from the downloaded solre package to the "core_test" directory

 

3. Solr background creates core

The browser opens the solr background: http://localhost:8080/solr/index.html, Core Admin->Add Core, enter core_test

Note: If the creation fails, pay attention to whether the console is missing the package

 

4. New Field search field

Select the core (core_test) just created, select schema, Add Field:

New Field

Here we create two test fields name(text_en), age(int)

 

5.. Add/Update Documentation

Earlier we created database tables and columns, the next step is to add data so that we can start searching.

Here we add documents to core_test in xml:

Core Selector->core_test->Documents, then select the XML type

<add>  
  <doc>  
    <field name="name">Michael Jordan</field>  
    <field name="age">53</field>
  </doc>  
  <doc>  
    <field name="name">James</field>  
    <field name="age">32</field>  
  </doc>
  <doc>  
    <field name="name">Curry</field>  
    <field name="age">28</field>
  </doc>  
  <doc>  
    <field name="name">James Harden</field>  
    <field name="age">27</field>  
  </doc>
</add>

 Finally Submit Document

 

6. Search content

Here is just a simple example, and it will be introduced in more detail later.

In "q", enter "name: James", and finally Execute Query, we can get the search results

query-search

  

Back to Contents

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327043293&siteId=291194637